Tuesday, April 8, 2014

Machine Vision Lens and Camera Selection Fundamentals (Part 1)

It has been a brief respite since I last written. Taking on a different hue, we discuss the essentials on lens and camera selection for an imaging project.

For any machine vision project, the very first thing to do is to determine the lens and the resolution of the camera used. In order to do so, it requires the knowledge on the smallest resolvable resolution and the operating field of view (FOV) needed by the application. In most cases these details are application and imaging algorithm dependent (this will be discussed on a separate article).

In this illustration, the type of lens used is assume to be CCTV lenses. 

Given a vision algorithm that requires 1 single pixel to be represented as 0.1mm and the field of view for the application has to be 10mm x 10mm, a camera of at least 1000 x 1000 pixels (10mm divided by 0.1mm) will be needed. 

Select a camera with pixel size of 5.5um (assuming kodak sensor) and 1000 x 1000 pixels, the lens will need to project the required image onto the pixels of the image sensor within the area of 5.5mm x 5.5mm.

Knowing the FOV (Field of View) and the projected image size on the sensor, the lens can be estimated.

Using thin lens assumption, the magnification of the image is almost in ratio of the focal length f, and the working distance. Selecting a 50mm (f) lens will give the following working distance

Working distance (WD) = (H*f)/H’ + f = (10/5.5) x 50 + 50 = 141mm

In the earlier result the back focal distance is not included in the calculation. For a C mount lens, the back focus distance (fb) is about 17.52mm. To maintain a focus image, the projected image on the image sensor is constrain by the following thin lens formula

1/f = 1/(fb+f) +1/(WD)  Eq2.0

Applying f = 50mm and fb = 17.52mm, the equation gives a working distance of 192.8mm.

With a working distance of 192.8mm the needed magnification or FOV cannot be realized (see Eq1.1), the working distance have to further reduce in order to increase the magnification. To do that, fb has to be increased by adding extension rings.

Apply f = 50mm and WD = 141mm
Using thin lens formular again, fb = 27.47mm
The total extension distance needed = 27.47-17.52mm ≈ 10 mm.

Following summarize the results in this example,
  •  FOV 10mm (given)
  • Per pixel representing 0.1mm (given)
  • Camera, 5.5um pixel size with 1k x 1k resolution (esitmate from FOV and resolution per pixel)
  • Lens C mount 50mm ( make a selection )
  • Working distance 141mm
  • Extension ring 10mm

This illustration exhibits a quick way to estimate the required lens setup and camera without having looking up at lens specification. A more accurate means of lens determination will require the use of the view angle instead of focal length provided by the lens specification. (to be discuss on a separate article)