Search tips
Search criteria 


Opt Lasers Eng. 2013 May; 51(5): 571–575.
PMCID: PMC3584619

A webcam in Bayer-mode as a light beam profiler for the near infra-red


Beam profiles are commonly measured with complementary metal oxide semiconductors (CMOS) or charge coupled devices (CCD). The devices are fast and reliable but expensive. By making use of the fact that the Bayer-filter in commercial webcams is transparent in the near infra-red (>800 nm) and their CCD chips are sensitive up to about 1100 nm, we demonstrate a cheap and simple way to measure laser beam profiles with a resolution down to around ±1 μm, which is close to the resolution of the knife-edge technique.

Keywords: Webcam, Bayer-mode, Beam profiler


► A cheap webcam was set into Bayer-mode and used as a laser beam profiler in the near infra-red. ► In Bayer-mode the size of a single pixel was around 2.8 μm. ► Together with a Gaussian fit we achieved a resolution of plus minus 1 μm for Gaussian beams. ► We were able to determine the mode quality factor of a laser.

1. Introduction

Measuring the beam profile of a laser beam is an important and common task for researchers or engineers dealing with lasers. In addition to laser power and pulse duration, only the knowledge of the exact diameter and beam profile allows for the determination of the local laser power on a sample or work piece. Especially in material processing and in medical applications it is crucial to have a well defined focused laser spot [1–4]. For determination of the beam profile and diameter several methods exist. A simple and cheap method is the exposure of thermal or photo paper. For pulsed high power lasers the ablation of photo-paper, thermally induced phase changes [5], or the generation of ultrasound by the photoacoustic effect [6] can be used. However, their applicability for the analysis of a focused laser beam is limited. The use of thermal or photo paper suffers from a low dynamic range (DR) and from the fact that the measured beam profile does strongly depend on the exposure time [4]. Thermally induced ablation or phase changes are affected from the so called heat affected zone (HAZ) [7], which does strongly depend on the substrate material and the pulse duration. For crystalline silicon and pulse-durations of 20 ns the HAZ may exceed 2 μm. The methods based on ablation or phase changes suffer from a poor dynamic range, i.e. an area is either ablated or not. Furthermore, the plasma plume, generated during ablation might partially shield the laser beam which may cause artifacts in the measured beam profile. The resolution of the photoacoustic method is limited to several μm [6]. Thus, these methods are unsuited for a beam analysis of tightly focused laser beams.

For laser spots with a beam width ≥10 μm one can use commercial CCD cameras, which have pixel sizes between 4.4 and 7 μm see e.g. [8–10]. The drawbacks of the commercial CCD or CMOS beam-profiling cameras are that they are rather expensive (>1000 EUR) while only providing relative low resolution. Smaller focused spots with diameters in the μm range can be analyzed by means of the scanning knife edge technique [11]. Here, one measures the power of the laser beam with a photo diode while moving a sharp edge through the laser spot. The resolution of the knife edge technique lies in the order of 1 μm, limited by diffraction at the edge [4]. The knife edge technique has two major drawbacks. First, the technique is rather slow. Thus, for example, analyzing single laser pulses is not possible. Second, no spatial resolution is provided, unless one does acquire multiple-knife edge beam profiles at different angles and subsequently calculates the beam profile. This, however, slows down the measurements even more.

A relatively simple and low cost way to measure laser beam profiles is the utilization of a webcam as demonstrated in [12]. With this method beam-profiling of pulses from a Nd:YAG laser with a wavelength of 1064 nm was demonstrated. In [12] the native resolution (about 9 μm pixel size) of the webcam was used, limiting the technique to relatively large spots.

Webcams usually are designed to record color-images. For this purpose they have color filters in front of each single CCD element. Such a single CCD element is called sub-pixel in the following. In most cases one color-pixel consists of four sub-pixels with separate color filters: one sub-pixel with a red color filter, two sub-pixels with a green color filter, and one sub-pixel with a blue color filter. These color filters are called Bayer-filter. In the EEPROM of the webcam the information from four sub-pixels is processed and the resulting RGB value for the combined pixel is returned. Before returning the RGB value further calculations are made on the webcam's EEPROM in order to improve the image quality, e.g. to correct the white balance. However, by using special software it is possible to access every sub-pixel element. In this mode the webcam is said to be in Bayer-mode.

In this paper we used a low-cost webcam for beam-profiling; whereupon we improved the resolution by making use of the Bayer-mode and using the property of the Bayer-color-filters to be transparent in the near infra-red region. The size of one sub-pixel was about 2.8 μm, which is about a factor of 2 smaller than the pixel size of nowadays commercial available CCD beam profilers. Depending on the wavelength of the examined laser the transmittance of the Bayer-filters was corrected by software. We demonstrated the capability of the technique by measuring the beam profile of a focused laser spot of a Nd:YAG laser at its fundamental wavelength of 1064 nm and by analyzing the Gaussian beam shape of a Ti:sapphire laser in the focal zone.

2. Material and methods

A Logitech C300 webcam, at a price of about 35€, was dismantled so that the CCD chip was freely accessible. By means of an optical microscope we determined the pitch size of a sub-pixel to be 2.79±0.02 μm. With the help of a freeware (bayer.exe) provided by Logitech we set the camera into Bayer-mode. For picture acquisition the freeware program QCFocus was used. This software allows for changing the exposure time between 1 ms and 0.2 s. After image acquisition the pictures were stored as a bitmap, whereas each pixel in the image had an 8-bit grayscale-value corresponding to the intensity of the incident light at the respective sub-pixel on the camera. As the color filters in front of each individual sub-pixel possess different transmission factors, the pictures had to be post-processed, whereby each sub-pixel value was multiplied by a correction factor. For post-processing Matlab was used. However, post-processing can be done in almost any programming language, including free-ware software as e.g. Python.

The applicability of the webcam was demonstrated with a pulsed Nd:YAG laser (Litron Nano-T, pulse duration 9 ns, repetition rate 10 Hz) and with a Ti:sapphire laser (Femtosource scientific XL 650 from Femtolasers) in pulsed (50 fs) and in continuous wave (cw) mode. The Ti:sapphire laser emitted at a wavelength of around 800 nm and the Nd:YAG laser had a wavelength of 1064 nm.

For focusing the laser beam onto the CCD chip we used either a lens with a focal length of 62.9 mm or a microscope objective (10× Mitutoyo Plan Apo NIR infinity). In order to avoid blooming or damage of the CCD chip we used a combination of neutral density filters and a variable beam attenuator for linearly polarized light (model 990-0071-800H from Eksma Optics). For the investigation of the beam from the Femtosource laser it was necessary to reduce the power before the neutral density filter to avoid artifacts by the thermal lens effect due to heating. Reduction of the laser power before the filter was done by utilizing the variable beam attenuator.

3. Results

The Logitech C300 exhibited an offset of 16 in the 8-bit Bayer-mode, thus reducing the number of effective bits to 7.9. If the offset was subtracted, the pixel value was proportional to the incident light intensity. A linear response of a webcam to the incident intensity was already reported by [12].

As first application we analyzed the beam profile of a focused Nd:YAG laser-spot using the microscope objective. The RAW picture of a laser spot is depicted in Fig. 1(a), showing a two-dimensional (2D) beam profile. One can see a checked pattern, caused by the different transmittances of the Bayer-filters. Fig. 1(b) shows the corresponding cross section of the beam along the dashed line in Fig. 1(a). Here, the different transmittances result in a zig-zag pattern. By multiplying the sub-pixel values with certain correction factors, cf, one can correct the pictures, as depicted in Fig. 1(c) and (d). In the 2D image and in the respective cross section the checked pattern and the zig-zag pattern have disappeared. The applied correction factors, cf, were determined experimentally: Starting with the RAW-image (as shown e.g. in Fig. 1a) we took a cross section at a line with red and green sub-pixels (see Fig. 1b) and performed a Fourier transform. To achieve smoothness the Fourier component corresponding to the checked pattern was minimized by changing the correction factor cf. The same was done for a cross section with green and blue pixels. Finally, the smallest correction factor was normalized to 1 and the other correction factors were corrected accordingly. For a wavelength of 1064 nm the correction factors were: cfred,1064 =1.45±0.05, cfgreen,1064=1.60±0.05, cfblue,1064=1. These correction factors have to be determined for every wavelength. For example, for a wavelength of 800 nm the values were: cfred,800=1, cfgreen,800=1.55±0.05 and cfblue,800=1.45±0.05. In the visible range, e.g. for λ=532 nm, the Bayer-filters work rather effective and high correction factors had to be used, i.e. cfred,532 around 3.6, cfgreen,532=1, and cfblue,532 around 3. The correction factors and the offset decrease the number of effective bits, and herewith the dynamic range DR:

equation M1

where b is the effective number of bits and cfmax is the highest correction factor. Thus, the maximum correction factors for 1064 nm, 800 nm, and 532 nm of 1.60, 1.55, and 3.6 reduce the resolution to 7.2, 7.2, and 6 bit, respectively.

Fig. 1
(a) and (b) Uncorrected beam profiles of a Nd:YAG laser spot. The checked pattern in case of the 2D beam profile (a) and the zig-zag pattern in case of the cross section (b) are typical for non-corrected profiles. (c) and (d) Corrected beam profiles. ...

As second application we analyzed the beam of the Femtosource laser operated in cw-mode. Twenty beam profiles were acquired in the focal region of −1 mm to 1 mm relative to the focus of a lens with a focal distance of 62.9 mm. First, the offset was subtracted from every sub-pixel-value. Then at each depth the diameter of the laser-spot was determined by a Gaussian fit G(x):

equation M2

where the laser beam center corresponds to the mean value μ and the area under the peak A determines the amplitude of the Gaussian fit. The beam width radius w defined by the intensity drop to e−2, is related to the variance σ2 by [13]:

equation M3

Statistical outliers, which are e.g. caused by noise, can influence the result of the fit. Outliers which are further away from the laser spot have a larger influence on the mean value and on the variance than outliers close to the spot. Therefore it is important to avoid noise far away from the laser spot. All sub-pixel values outside the laser spot, i.e. the area at which the measured beam profile was zero with exception of noise, were set to zero prior to the determination of the mean value μ and the variance σ2.

In Fig. 2 a focused cw Ti:sapphire spot is depicted. The beam profile and the corresponding Gaussian fit are shown in Fig. 2b. Theoretically, the minimum beam waist radius w0 for a Gaussian-like beam behind a lens is given by [13]

equation M4

where f is the focal length of the lens, λ is the wavelength of the light, wL is the laser spot waist radius before the lens, and M2 is the mode quality factor. From the twenty beam profiles acquired in the focal region we found the minimum beam waist radius w0 to be 10.6±1.1 μm.

Fig. 2
Beam profile of a focused cw Ti:sapphire laser spot and its corresponding Gaussian fit: 2D profile (a) and cross section (b). The beam radius is 10.8 μm; the cyan dashed line in (b) marks the Gaussian fit.

The beam waist radius as a function of the distance from the focal point, w(z), is given by [13]

equation M5

where z is the distance from the focal point. The measured beam radii over the scan depth are depicted in Fig. 3. At each position, z, a single beam profile was recorded. With exception of the two outermost measurement points all measurements shown in the figure were recorded with the same exposure time of 1/400 s (shown as full circles). As the intensity decreases with increasing distance from the focus, the two outermost points were recorded using a longer exposure time in order to achieve a larger dynamic range. These two points are marked as empty circles in Fig. 3. The laser power was the same in all measurements.

Fig. 3
Beam waist radius, w(z), as a function of distance from the focal plane: measurement (dots) and calculation (lines). The three curves correspond to mode quality factors M2 of 1 (lowest curve), 1.1 (middle, dashed), and 1.3 (top curve, dashed-dotted), ...

In Fig. 3 the error bars indicate the uncertainty in pixel size and uncertainties regarding the evaluation concerning the Gaussian beam profile and transmission correction factors. For evaluation of the latter, the correction factors were varied within the previously determined uncertainties (e.g. cfgreen,800 between 1.5 and 1.6, see second paragraph of Section 3). Different correction factors resulted in different beam widths. The error for each individual beam profile was determined as the difference between the smallest and largest beam width obtained from Gaussian fits. These resulting errors were found to be around ±1 μm. Additionally, the error due to pixel size (±0.02 μm, see Section 2) was considered via propagation of uncertainty. For the small spot sizes (10 μm) this error was approximately ±0.08 μm. For the large spot sizes (30 μm) the error due to pixel size was approximately ±0.2 μm. The total error, which is shown in Fig. 3, was therefore around ±1.1 μm and ±1.2 μm for the small and large spot sizes, respectively. A compilation of errors for different spot sizes is given in Table 1.

Table 1
Compilation of different beam waist radii and their corresponding uncertainties of some beam profiles of Fig. 3.

In Fig. 3 three theoretical curves of w(z) are given for M2=1 (lowest curve), M2=1.1 (middle curve), and for M2=1.3 (top curve). The Femtosource laser is specified to have an M² factor below 1.3 [14]. From Fig. 3 it can be seen that the curve for M2=1.1 describes the measurements best.

Noise that occurred during the measurement was solely caused by ambient light and scattering of laser light at optical components. Although the experiments were performed in a darkened room, scattering of laser light at optical components and lit switches from technical instruments were unavoidable. Thermal noise introduced due to ambient temperature was found to be no issue for our short exposure times.

The measurements were performed with highly attenuated laser beams, with mean powers below 1 μW and pulse energies below pJ. Experiments with silicon microdisks showed that cw laser powers of 1 μW lead to heating below 1 K [15]. For short laser pulses only a part of the material gets heated, i.e. the volume where the laser beam gets absorbed, followed by thermal diffusion. The temperature rise at the laser energies employed in the present paper was estimated to lead to a temperature increase in the order of mK (material constants were taken from [7]). From the experiments and the calculation we expected no significant increase in temperature. As neither ambient temperature nor heating due to absorption of laser radiation was found significant, cooling of the CCD chip was not necessary.

4. Discussion

In Fig. 1(c) the 2D beam profile of a spot from a pulsed Nd:YAG laser with a pulse length of 9 ns is shown. We were able to record videos with frame rates up to 15 frames per second. As the repetition rate of the laser was 10 Hz, we were able to record full profiles of every single laser pulse. This demonstrates the fast acquisition time compared to e.g. the knife edge technique where such measurements would not be possible.

We recorded beam profiles of the Ti:Sapphire laser in pulsed mode (50 fs) too. The obtained beam profiles were very similar to the one shown in Fig. 2. This demonstrated that one can use the webcam even for investigations of femtosecond laser pulses. As the beam profiles of the Ti:sapphire laser were very similar when operated in pulsed mode or in cw–mode images of pulsed laser spots are only shown for the Nd:YAG laser (Fig. 1).

The uncertainties in beam width were shown to be in the order of ±1 μm for Gaussian-like beams, which is less than the size of one pixel. This is a consequence of the Gaussian fit, which provides additional information on the beam profile. For non-Gaussian beams the resolution is given by the pixel size, which is 2.79±0.02 μm. For the Femtosource XL 650, specified with M2<1.3 [14], an factor of 1.1 was found. From this measurement we conclude that the laser is within it specifications. The minimum beam waist radius w0 behind the lens was measured to be 10.6±1.1 μm. This corresponds to a beam waist radius before the lens, wL, of 1.67±0.17 mm (Eq. (4)). The beam waist radius without lens was measured to be 1.5±0.15 mm. Both values coincide within the uncertainties.

We showed that the change in exposure time from 1/400 s to 1/50 s (two outmost measurement points in Fig. 3) gave consistent results. By changing the exposure time one can therefore partially compensate for the smaller DR compared with commercial beam profilers.

Although there is a small glass plate in front of the CCD chip, we did not find any detectable imaging artifacts if the camera was cleaned and properly aligned. The image quality was actually good enough to permit detection of unintended thermally induced refractive index changes in the neutral density filters and lens aberrations due to optical misalignments. Determination of beam profiles in the visible region was also possible. However, the correction factors were rather high, as the Bayer-filter works efficient in this wavelength regime. Thus one can either use the webcam in Bayer-mode, at low dynamic range, or without the Bayer-mode, resulting in a decreased resolution of around 5.6 μm. In the latter case the resolution is not better than that of conventional CCD chips, which lies between 4.4 and 7 μm.

5. Conclusion

We used the properties of the Bayer-color-filters to be mostly transparent in the spectral range of 800 to 1064 nm and of silicon-based CCD chips to be sensitive to incident light up to around 1100 nm for building a light beam profiler for the near infra-red region. By employing the Bayer-mode and by correcting for the different transmission factors of the color filters we demonstrated acquisition of beam profiles and determined the beam waist of a focused Gaussian-like laser beam with an uncertainty of around ±1 μm without additional optics. The demonstrated technique allowed to record 2D profiles of pulsed laser spots with a frame rate of 15 Hz, which is impossible with the knife edge technique. The demonstrated technique is more than a factor of 20 cheaper compared to commercial beam profilers based on CCD chips. Compared to the latter, the resolution is even around a factor of two better.


This work has been supported by the Christian Doppler Research Association, the Austrian Science Fund (FWF), Project no. S10503-N20, the European Regional Development Fund (EFRE) in the framework of the EU-program Regio 13, and the federal state Upper Austria.

The authors like to thank H. Roitner and H. Grün for fruitful discussions.


1. Roundy C. Beam profiling improves laser welding. Photonics Spectra. 2005;39(8):32.
2. Cerniglia D., Pantano A., Mineo C. Influence of laser beam profile on the generation of ultrasonic waves. Appl Phys A. 2011;105:959.
3. Karsai S., Pfirrmann G., Hammes S., Raulin C. Treatment of resistant tattoos using a new generation Q-switched Nd:YAG laser: influence of beam profile and spot size on clearance success. Lasers Surg Med. 2008;40:139. [PubMed]
4. Dickey FM, Holswade SC, editors. Laser beam shaping: theory and techniques. New York: Marcel Dekker; 2000.
5. Liu J.M. Simple technique for measurements of pulsed Gaussian-beam spot sizes. Opt Lett. 1982;7:196. [PubMed]
6. Mallidi S., Emelianov S. Photoacoustic technique to measure beam profile of pulsed laser systems. Rev Sci Instrum. 2009;80:054901. [PubMed]
7. Bäuerle D. Laser processing and chemistry. Berlin: Springer; 2000.
8. Operation manual BC106-VIS. Thorlabs; 2011.
9. User manual LaserCom-HR beam diagnostics digitial CMOS camera. Coherent. Portland, Oregon; 2005.
10. Datasheet Gevicam. Ophir Photonics; 2012.
11. Suzaki Y., Tachibana A. Measurement of the μm sized radius of Gaussian laser beam using the scanning knife-edge. Appl Opt. 1975;14:2809. [PubMed]
12. Cignoli F., De Iuliis S., Zizak G.A. Webcam as a light probe beam profiler. Appl Spectrosc. 2004;58:1372. [PubMed]
13. Saleh BEA, Teich MC. Fundamentals of photonics, 2nd ed. Hoboken: John Wiley & Sons; 2007.
14. FemtosourceTM scientificTMXL manual version 0.99 from Femtolasers.
15. Langer G. Fabrication and characterisation of SiGe microdisks. PhD thesis; 2012.