Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Vison Toolkit to detect focus

Solved!
Go to solution

 

I am using 8.6.1 with the vision 8.6.4 Vision toolkit.  I am grabbing images from the 1422 frame grabber from a CCD sensor and need to generate a test to detect how focused the lens for the sensor is.  The user will manually focus the lens using a test pattern and then I need to display a level of how in focus the image is (beyond the human eye detection).

 

I am very new to testing video and images and have not used the Vision toolkit before.  I would like to know if anyone knows how to go about using the vision toolkit to detect levels of focus.

 

Right now we are using standard star charts and zone charts to detect focus, but I don't know if these will work well for automation with the vision toolkit.  Do I need to make a custom chart with objects that are close together and use the object detection algorithm?  Like I said, I am very green in the vision arena.  Any help would be greatly appreciated.

 

Thanks.

0 Kudos
Message 1 of 4
(4,335 Views)
Solution
Accepted by topic author klessm1

Search the forum for auto focus.  There have been several previous discussions about it that might help you.

 

The simplest way to measure focus is to use edge detection then quantify the resulting image.  The mean value follows the focus pretty well, and the standard deviation follows it pretty well also.

 

You can't really use this method to provide an absolute measurement of focus quality, though.  You never know what the maximum value is going to be, but you can watch it go up or down as you adjust the focus.  It works really well for automated focusing.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 2 of 4
(4,334 Views)

The other posts didn't help much, but you just did.  I used the edge detection and then the histogram to get the mean and stdev and those numbers follow the focus very well with the test charts I am using.

 

Thanks!

0 Kudos
Message 3 of 4
(4,326 Views)

I probably should have told you to search for measure focus, not auto focus.  It comes up with two other discussions where I gave very similar answers.

 

In any case, glad it works for you.  You should probably mark it as a solution so everybody knows your problem is solved.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 4
(4,298 Views)