Jump to content

Detect Image Focus with NI Vision


Recommended Posts

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.

Link to comment

A common method to measure (relative) focus is to look at the spatial contrast of an image - look at how quickly the intensity of the image changes in the area of interest. If it's a gradual change you image is less ofcussed than a fast (or tight) change.

Link to comment

Thanks.

I used the edge detection followed by the histogram and the mean and stdev follows the focus very well. The better the focus the more edges and the higher the mean and stdev. Especially with the star and zone charts that I am using.

Link to comment

Another method which is very effective is to look at a line of pixels (line profile) and look at the rate of change at edges. If you are in-focus and looking at series of lines and spaces you will get sharp peaks which become much flatter and rounded as you go out of focus. A simple d/dx will give you the rate of change.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.