Sharpness evaluation

Dear community,

I would like to ask, if there is some elegant possibility to evaluate sharpness of an image via scripting. I have checked Autofocus script and I think I understand (more/less) how it works. However, I was not able to extract just evaluation of sharpness from it.

I will be happy for any advice.
Best regards,
Jiri

You may have a look at the paper of Mir et al. (2014).

2 Likes

Hi Jiri,

I just got some code that I’ve been using on my own but which may be useful to you merged into the development branch of Micro-Manager: Sharpness Inspector Plugin by nanthony21 · Pull Request #1132 · micro-manager/micro-manager · GitHub

It should show up tomorrow in the nightly build. There will now be an Image Sharpness section in the inspector panel which allows to easily view a plot of image sharpness.

There is also now a utility Java class at org.micromanager.imageprocessing.ImgSharpnessAnalysis which you could potentially use from a beanshell script. You can view the source code here: micro-manager/ImgSharpnessAnalysis.java at 05968c8953c3aee5978c086917a36914caf7f21b · micro-manager/micro-manager · GitHub

I haven’t tested this but an example script might look something like:

import org.micromanager.imageprocessing.ImgSharpnessAnalysis;
import ij.process.ImageProcessor
ImgSharpnessAnalysis anlsis = new ImgSharpnessAnalysis();
anlsis.setComputationMethod(ImgSharpnessAnalysis.Method.Redondo);

ImageProcessor proc = mm.data.getImageJConverter.createProcessor((mm.live().snap().get(0)));
double sharpness = anlsis.compute(proc);
1 Like