Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Detection of Focus/Blurrness

Hello,

I am working on a project with Auto Focusing of samples, I need to Detect if the Image captured by camera is fully focused or is it not focused (Image Blur factor).

I need some Guidelines to solve this.

For example i am attaching an image which shows both blur and fully focused for Reference.

Need support to solve this.

0 Kudos
Message 1 of 9
(2,187 Views)

You can't just examine an image and easily determine if it is focused or not.  All the methods I have used just give a relative measure of focus - is this image more or less focused than this image.

 

The simplest method is using one of the edge detection routines followed by a quantify image. The standard deviation of the edges gives you a great focus indicator: The larger the value, the better the focus.

 

Search the forums for autofocus for more details.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 9
(2,180 Views)

There are couple of options to do that. But they all base on special cases. I don't know of general solution.

1. If you have the information from the focus process you can estimate if the one image you got at the end is close to the peak.

2. If you have a know object in the image. For example fiducial point that has sharp edges. Then you can estimate from this object if you are in focus.

3. We are using second method in our system. Seems to be working well.

Amit Shachaf
0 Kudos
Message 3 of 9
(2,162 Views)

Hi,

Thanks for the reply.

But i cannot feed in the image. I have to extract a color plane to quantify it, or I see Error pop ups like "RGB 32bit images are not supported".

I am currently testing sequence in Vission Assistant. How can i input feed an image and direclty quantify it?

0 Kudos
Message 4 of 9
(2,145 Views)

This is what i get when i try to use original Image. I had to extract color plane and then only i can use it.

0 Kudos
Message 5 of 9
(2,142 Views)

Yes, all the methods I know only work on grayscale images.  The simplest solution is to convert the image to the intensity or brightness color plane.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 6 of 9
(2,135 Views)

I will definitively give a change to entropy-based methods to get relative focus.

Here is article, for example:

https://asp-eurasipjournals.springeropen.com/track/pdf/10.1186/s13634-016-0368-5.pdf

In general Shannon entropy (or simple StdDev) may give you this information.

Simple example in attachment (LabVIEW/VDM 2022Q3)

 

0 Kudos
Message 7 of 9
(2,121 Views)

I had this old example lying around but I can't run it since my PC is currently not detecting my camera.

It does use some VDM vi's though.

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 8 of 9
(2,101 Views)

@AnalogKid2DigitalMan wrote:

I had this old example lying around but I can't run it since my PC is currently not detecting my camera.

It does use some VDM vi's though.

 

-AK2DM


Thanks for sharing! I added this idea into example above, so it can be run without camera. May be will be useful for someone... Resaved in LV2022Q3.

Andrey.

Message 9 of 9
(2,086 Views)