# How to measure the size of a laser dot?

I'm not a physicist, that's why I'm asking you if there is maybe an easy way (e.g. a mathematical law) to measure the size of a laser dot, or its diameter.

The setup

It contains a laser, a high speed camera and other utilities. Now I'm using the cam to take a picture of the laser dot on a particular surface.

The problem

I need to determine what is the actual size of a pixel in physical space (i.e. how many mm are displayed by one pixel). So I need to scale my pixels and I was thinking about the following equation as a factor for 1 pixel :

$$\text{scaling factor} = \frac{\text{diameter}}{n_P},$$ where $n_P$ stands for the number of pixels it takes to display the diameter

$\text{diameter}$ is the actual diameter of the laser dot in SI values (e.g. cm)

The Question

Now unfortunately at the moment I can't think about much better ideas than just measuring the diameter by hand with a caliper. But I'm afraid to call this a real solution, it sounds more like a workaround.

Does somebody has a better idea?

• You can take a picture and count pixels. Jan 21, 2015 at 21:14
• @ja72 and how do I get the cm out of it ? Jan 21, 2015 at 21:15
• Lay a ruler next to the laser or something else of known size for calibration. Jan 21, 2015 at 21:17
• If you're going for a metric-unit measurement, is there a reason you shouldn't simply use calipers? You say it feels like a "workaround," but any other method I can imagine would be both less precise and more work. Jan 21, 2015 at 21:17
• Say you have two meter sticks. Put one a certain distance away and take a picture. Now tape the two together, put them the same distance away and take another picture. The double ruler will measure twice as many pixels long in the picture. So yes, your scaling factor will work. A free piece of software used for exactly this purpose is called ImageJ. Jan 21, 2015 at 21:18

First - know that a laser spot is not a "disk"; usually you will find that the intensity drops off from the middle to the edge, so "size of the spot" is an imprecise concept (where is the edge of a gradually decreasing curve?). Secondly, unless the laser is normally incident on the surface, the spot will most likely not be circular but elliptical; and unless you are viewing the surface normally, you will add an additional distortion.

All this makes it difficult to do this right. I would recommend that you place some graph paper (remember graph paper? It's what we used before computers could draw graphs... - it comes with markings in mm, with major markings for cm) on the surface where you project your laser dot, and take a picture of it. For precise measurements you can buy optical grids in many sizes - more expensive but much more accurate.

Unless the grid is perfectly normal to the axis of your camera, it will be distorted; but if you align it properly you will be able to count the pixels between lines on the grid in your image.

There are several tricks you can use to be more accurate. If you tilt the grid slightly (rotate about the normal) then the lines will cross rows and columns of pixels: this will allow you to find the place where the line aligns exactly with a pixel, and lets you get to sub-pixel accuracy. Second, you should count pixels across a number of lines; say you can see ten lines of the grid, you can calculate the distance by dividing the number of pixels between line 1 and 10 by 9 to get the number of pixels per mm.

Even more accurate would be to write down the pixel number for each line, then fit a straight line through the points. When you then subtract the best fit from the data you will be able to see whether there is any pincushion distortion (non linearity in the scaling of the camera with respect to position) at which point you can compute the scale factor at any point.

Finally, you could do this mathematically if you know the distance to the object exactly, and you know the focal length of the lens. This is actually quite hard to do because it's unlikely that you know the exact location of the optical center of the lens, but that depends on your setup.

In principle, if you have an object that is distance $o$ from the lens with focal length $f$, then in order for the object to be in focus you need the lens at a distance $d$ from the focal plane such that

$$\frac{1}{f} = \frac{1}{d}+\frac{1}{o}$$

Or, if you know the focal length of the lens but not the center of the lens, but you can measure the distance from the object to the sensor, $s = o + d$, then you can do

\begin{align}\frac{1}{f} &= \frac{1}{d} + \frac{1}{s - d}\\ &=\frac{s-d}{d(s-d)} + \frac{d}{d(s-d)}\\ &=\frac{s}{d(s-d)}\\ d(s-d)&=f\cdot s\end{align}

We can solve this quadratic for d:

$$d^2 - ds + fs = 0\\ d = \frac{s±\sqrt{s^2-4fs}}{2}$$

And then the magnification follows from

$$M = \frac{d}{o} = \frac{d}{s-d}$$

If you know the actual pixel size (usually this is given by the manufacturer) you can then get the magnification from this equation and get your pixel to mm conversion:

$$c = \mathrm{(Pixel\ size)\cdot M}$$.

So if your pixel is 0.1 mm and your magnification is 3, then one pixel corresponds to 0.3 mm in the image (at that particular distance).

• thanks for that precise answer. Getting straight lines on the monitor when comparing with a graph paper shouldn't be a problem, since image processing techniques are pretty common to me. But actually I'd like to avoid attaching anything to the object of interest. I could try to apply the formulas of your suggestions. What I've missed to tell is, that the distance between Laser and Object of Interest should be variable. For this purpose I could develop a laser-range finder with the already used hardware. I have to check it when I'm at desk again Jan 21, 2015 at 23:35
• If the distance is variable them so is the pixel-to-mm conversion... Range finding can be hard depending on the speed and precision needed. Consider projecting two parallel laser beams of known separation to give you a "calibration distance". Jan 21, 2015 at 23:38
• Well do I get this formulas right, that they only work if the object of interest is a plane where the point of (camera)view conforms the normal of this plane? So if my PO(C)V is rotated a little bit to the normal this would distract the accuracy of the results right ? Jan 21, 2015 at 23:42
• with variable its meant, during the measuring series every distance stays constant, but from series-to-series the distance changes. Jan 21, 2015 at 23:44
• Yes if the plane is tilted one dimension will appear to be compressed; and the focusing of the lens will change the magnification. As long as the object is always "far" from the camera (>20f) you may be able to ignore that effect - it all depends on the required accuracy. Precision takes attention to detail... Jan 22, 2015 at 7:45

Its simpler than I thought at first so I edited extensively:

It sounds like you want to know two things: 1) The size of the pixels of your sensor and 2) the size of your laser spot. I would solve 1) and then use the known size of the pixels to find 2). Assuming that you can't just the pixel size from the manufacturer spec sheet or want to verify it experimentally here are two methods.

Method 1: Assumes a columnated beam but requires no specialized hardware other than what you said that you have.

Step 1: Find the pixel size. If you know the wavelength of the laser, the laser is columnated, and you have an aperture (small hole) (the smaller the better), you could pass the laser through the aperture to obtain a Fraunhofer diffraction pattern:

$I(\theta)=I(0)(\frac{2J_{1}(ka \sin{\theta})}{ka \sin{\theta}})^{2}$,

I is the intensity of the light in the far field, J1 is the Bessel function, a is the diameter of the aperture and $k=\frac{2\pi}{\lambda}$. You can measure theta very accurately by diffracting for a long distance say from one side of the lab to the wall on the far side and carefully measuring the distance from the central intensity maximum to the first minimum and doing a little trig. Since the aperture size and the wavelength are fixed, this diffraction angle will be also. Since you know this angle you know the size of this central diffraction disk as a function of distance from the aperture.

By illuminating the camera with this diffraction pattern at a known distance from the aperture you can find the pixel size experimentally by pixel counting the diameter of the central diffraction spot (Airy disk).

Step 2: Find the laser spot size. Remove the aperture and shine the laser directly on the camera and just pixel count. Since you know the size of the pixels from step 1 this is straight forward.

Method (2): Assumes you have a mechanical stage with fine control. This is really simple. Attach an index card or thin sheet of sheet metal, etc so that it blocks part of the camera, by putting it right in front of the camera. Take an image then translate the card a known amount and take another image. Compare the two images an pixel count. If the edge of the index card was moved by 1 mm and it moved 1000 pixels then your pixels have a size of 1 um each.

• do you have a link ? do I get accurate values out of it ? What exactly is meant with the diameter of the aperture (= diameter of laser dot?) Jan 21, 2015 at 22:00
• <en.wikipedia.org/wiki/Airy_disk> describes diffraction through a circular aperature. Aperature size refers to the diameter of the hole. It is important that the hole through which you pass the laser is smaller than your collumnated laser. This can be quite accurate, but is limited by your ability to accurately measure distances, and the distances and the distance that you have available, which is typically limited by the size of your lab or the power of your laser. Jan 21, 2015 at 22:14
• If you can pry the lens off the front of the camera, there is an easier way to get the size of the pixels on the sensor: illuminate the sensor directly with the beam, place a screen at a known distance from the sensor, and measure the distance (and therefore the angle) between the spots in the back-reflected diffraction pattern. Jan 22, 2015 at 6:56

You can calculate the size of a pixel in the final setup by measuring the dimensions of the surface area captured in the image and dividing by the pixel-wise width and length of the image the camera creates.

Having the experimental setup in place for this measurement is important because factors such as the zoom factor of the lens and the distance of the camera from the surface will change the results. Obviously if you zoom or move the camera (rather, change the relation of the camera to the surface), the pixel/size ratio will change.

EDIT: More specifically: if you have a live feed of the image generated by the camera, you can measure the boundaries of the image space by watching in the camera feed as you measure. For example, if your image space is only several centimeters, you can line up a pair of calipers such that one arm is aligned with the left side of the image, and the other arm is aligned with the other edge; at this point you're measuring (with the calipers) an imaginary "object" which is the size of the picture your camera captures. Say this dimension comes to 27mm overall; now you can divide that by the width of the digital image captured by the camera. If your camera captures, for example, a 1000-pixel-wide image, you now know from measuring the image space that 1px = .027mm and thus if the laser dot is 40px wide when imaged, that corresponds to a width of .10mm.

• but how do I derive the diameter (in physical space) to scale my pixels, that's my actual problem. I don't know the exact value Jan 21, 2015 at 21:25
• @user3085931 Perhaps I misunderstood the question. Are you trying to determine the size of the laser dot, or the size of a pixel? Either one is going to require that you first measure - physically, with calipers, metersticks, etc. - some reference object or image in actual space. There's no way to calculate abstractly how large a real object is. Jan 21, 2015 at 21:33
• Easy said: I want to know very precisely the diameter in physical space (I'd prefer accuracy < mm Jan 21, 2015 at 21:36
• Then you will need a measuring device with a precision less than 1mm. Do you have a live feed view of the image the camera generates? If so I can update my answer with a specific method to calculate pixel size, allowing you to use the pixels themselves as a fine-grained measuring tool. Jan 21, 2015 at 21:46
• unfortunately not atm. I could show a picture tomorrow. Well I just don't feel right measuring it by hand, that way it's pretty impossible to measure < mm Jan 21, 2015 at 21:51

You could cut a hole of a known size in a piece of paper and place it over your detector. Then, you could see how many pixels are still illuminated. The known size of the aperature makes the conversion easy.

• this seems like a too less precise method for my aim Jan 21, 2015 at 21:24