Blur detection in imagej

Dear All,

Is there any plugin in imagej to detect and measure the degree of blur of an
image?

Thanks
Vincent

Hey @vincent,

maybe an image quality measurement does the job?

https://imagej.net/Microscope_Focus_Quality

Also, if you could share some example images, we could guide you better :wink:

Cheers,
Robert

Dear Robert,

It seems that the Microscope Image Focus Quality plugin can’t identify image blurring. I have read some paper suggests the use of haar wavelet transform to detect blur but I can’t find any imagej plugin for that purpose.

http://www.cs.cmu.edu/~htong/pdf/ICME04_tong.pdf

Regards
Vincent

May I ask what’s causing the blur?

Your question has no generic answer. Imagine a photo of a white wall. How do you expect to measure “blurring” in such situation?

The blur is caused by movement

Are you doing video processing? Could you subtract two subsequent images? Or measure local contrast and differences in local contrast?

If you could share an example image (sequence) it might be easier for us to point you in the right direction :wink:

Sorry I should be more specific. I’m working on a project to identify blur mammogram (the blur can be local or global) for example the one on the left is blur and the one on the right is clear

I see. This looks very tough. I hardly see a different in these two images. However, if you are looking for a measurement of local contrast (which is decreased in case of motion blur), you could start by applying a standard-deviation filter.

Starting from your image, this macro executed in Fiji:

run("8-bit");

// Local standard devuation filter as surrogat parameter for local contrast
run("Standard Deviation", "block_radius_x=5 block_radius_y=5");

// visualisation
run("Enhance Contrast", "saturated=0.35");
run("Fire");

// configure measurement to do pixel statistics
run("Set Measurements...", "mean standard min redirect=None decimal=3");

// measure on left side
makePolygon(269,119,211,168,173,246,140,303,173,339,235,347,319,345,331,273,320,199,315,139);
run("Measure");
// measure on right side
makePolygon(602,121,568,120,529,156,500,193,470,225,466,269,490,295,518,321,556,338,589,341,647,345,673,306,687,253,670,187,667,145,631,122);
run("Measure");

results in this visualisation and measurement of local contrast:
image

image

I hope that helps

Cheers,
Robert

I did something to very loosely recreate the code flow from this paper: https://www.sciencedirect.com/science/article/pii/S1877705813016007

Here’s the macro for a starting point.
blur_index.ijm (1.3 KB)

I used it to determine when to chop off the blurry part of a large zstack of SPIM data, so I wasn’t splitting hairs. You may need to consider the thresholding in the macro, and/or think about adding user selected regions of the image.

Neil

1 Like

Run an FFT power spectrum of a line across a sharp edge. This is equal to the MTF. Compare it with a sharp image’s edge. Keep the line lengths the same.

1 Like

I run an FFT on both blur and unblur image and I cannot see the difference

A simpler method is to look at the max - min in a similar area. The in focus image will have a greater value. It’s sigma (std Dev) can also be used as an indicator. The bigger the more in focus.

This is usually done across a high contrast edge…