08-29-2022 05:35 AM
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.
08-29-2022 06:46 AM
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
08-29-2022 12:02 PM
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.
08-30-2022 06:29 AM
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?
08-30-2022 06:31 AM
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.
08-30-2022 09:31 AM
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
08-30-2022 10:46 AM - edited 08-30-2022 10:49 AM
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)
08-30-2022 12:58 PM
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
08-31-2022 06:51 AM
@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.