Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

autofocus algorithm

I have an Allied Marlin mounted on a linear motor stage from Aerotech.  I have Areotech motion control subVIs that move the motor.  The linear drive is in the direction of the camera axis.  I have an Edmund Optics NT56-678 telecentric lens.
 
My object is a flat panel display.  I can see pixel structure, meaning the metalization lines within each RGB pixel.  So, there are bright lines of chevrons that outline each pixel.  My point is that there is a nice 'skeletal' pattern for matching.
 
I was wondering whether matching to the width of these metalization lines would be a good way to focus on them.  I would measure the width and then send a command to motion for moving the camera away or clser to the flat panel.
 
Does anyone have any experience or suggestions or example code for doing this?
 
Thanks in advance for your help.
 
Best wishes,
Jim
0 Kudos
Message 1 of 2
(8,783 Views)
Jim,
 
I would suggest using a standard focus measurement routine.  The best I have found uses edge detection to measure the strength of the edges.  The measurement gives a maximum value when the focus is best.  I believe it uses Sobol edge detection then takes the standard deviation of the entire image.  If you search the discussion forums for autofocus, you should find the example that I posted a few years ago.
 
Once you can measure the focus, you can move the stage through a range of positions and interpolate the peak value of the focus indicator.
 
Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 2
(8,775 Views)