Imaging Basics: How to Calculate Resolution for Machine Vision

 

 


 

 
Camera image resolution is defined by the number of pixels in a given CCD or CMOS sensor array.  This will be identified in a camera data sheet and shown as the number of pixels in the X and Y axis (i.e 1600 x 1200 pixels). 
The application will determine how many pixels are required in order to identify a desired feature accurately.  This also assumes you have a perfect lens that is not limiting resolving the pixel (see Demystifying lens specifications).  In general more pixels is better and will provide better accuracy and repeatability.  
 
 If for example you have a dark hole on a white background filling your field of view (FOV) by 90%, you will have many pixels across the feature.  On the contrary, if we have a small pin hole that is within the same field of view, we may not have enough pixels across the hole to identify the feature.  In order to find an edge you need at a minimum of 2 pixels given excellent contrast.  In order to be robust you ideally will want 3-4 pixels across a edge or feature.  
This leads us to identifying the resolution required given the size of a feature.  We will do this with an example and provide the needed formulas on how to calculate the resolution.
Example:  The vision inspection is to locate a pin hole which is 0.25mm in diameter on a part which is 20mm square.  In order to compensate for any misplacement of the part, we will set our FOV to 40mm x 30mm.  We would also like to have a minimum of 4 pixels across the 0.25mm feature.  

We can calculate the resolution required as follows:


Where:


Rs is the spatial resolution (maybe either X or Y)

FOV is the field of view dimensions (mm)  in either X or Y
Ri is the image sensor resolution; number of pixels in a row (X dimension) or column (Y dimension)
Rf is the feature resolution (smallest feature that must be reliably resolved) in physical units (mm)
Fp is the number of desired pixels that will span a feature of minimum size.

For this case we know: 


FOV(x) =  40mm

Rf = 0.25mm
Fp = 4 pixels

Calculating the spatial resolution (Rs) needed:

Rs = Rf / Fp = 0.25mm / 4 pixels = 0.0625mm pixel

From the spatial resolution (Rs) and the field of view (FOV), we can determine the image resolution (Ri) required (we have only calculated for the x-axis) using this calculation:


Ri = FOV / Rs = 40mm / 0.0625 mm/pixel = 640 pixels


We have now determined that we need a minimum resolution of 640 pixels in the x-axis to provide 4 pixels across our feature that is 0.25mm in diameter. The camera resolution can now be selected!  In today’s world, we could select a VGA (640 x 480) camera for the application.  As a note, the number of pixels required depends on many aspects of lighting, optics and algorithms used for processing.  This calculation method assumes optimum conditions.     


If you do not like math, you can download our resolution calculator here and just enter the data.  This makes it easy to test various iterations.  Download the calculator HERE. 


If you visit our camera page, you can sort by resolution in X and Y resolutions to quickly ID cameras that meet your resolution needs. 


For all your imaging needs, you can visit www.1stvision or contact us! to discuss your application in further detail or receive a quote on a desired camera.  We can also help identify which sensor is best based on the imaging conditions.  
     https://www.facebook.com/pages/1st-Vision/944658058935262?fref=ts             

Demystifying Lens performance specifications

Machine vision lenses from various manufacturers may look similar, have identical focal lengths, but perform different… but why?

The images above were taken with the same 5MP CCD GigE camera, identical iris and focus setting BUT with two different $250 class “Megapixel” C-mount lenses.  What lens would you choose?  

 

The correct selection would be the lens that resolves the sensor pixel size and provides you with crisp images.  Too many times we have seen lenses paired incorrectly providing blurred images as seen on the right image even if they are classified as “Megapixel” lenses.  

This can be avoided by understanding the lens performance in terms of the modulation transfer function also known as MTF which gives you the performance of light through a medium. It compares the intensity of the light before the optics vs. the intensity of the light after it goes through the optics. This is not a single number, but rather it varies as light hits the lens on or off axis, and is also dependent upon wavelength of the light. MTF is normally given in line pairs/mm or lp/mm vs. % transmission. Essentially, it tells you how well the lens can resolve a certain size spot. If you draw lines that get closer and closer together, at some point the optics system is going to see the 2 lines as a single blurred line. This is basically where the lens breaks down, and this is just past the limit of its resolving power.

In the diagram below you can see as the lines get closer together the intensity fades. (picture courtesy of Schneider Optics)

Note: Some lens manufacturers give MTF as only lp/mm and not vs. % transmission. E.g 60
lp/mm. This does not mean that you cannot see objects smaller than this MTF, it is just that the intensity of the image is lower than 100% at this rating. As the intensity drops at some point your eye or the processing SW can not distinguish between line pairs.



Ideally, the total MTF is derived from a multiplying all the MTFs of the system. This would include the MTF of the lens, the filter, the camera, the electronics, etc.

So if you have a megapixel sensor with a high MTF, but put a low cost lens in front, you have degraded the MTF of the system.  Garbage in, garbage out!  


The bottom line is to know the pixel size of the given sensor in which you can then derive the lens resolving power in terms of lp/mm.  In some cases, curves are available to plot lp/mm versus contrast providing the MTF of the lens.   You are now in a position to select a lens matched to your sensor!

For a comprehensive understanding on “How to Choose a Lens”, download our whitepaper HERE.  

For all your imaging needs, you can visit www.1stvision or contact us! to discuss your application in detail.  

     https://www.facebook.com/pages/1st-Vision/944658058935262?fref=ts