2
$\begingroup$

Suppose I have a blurry image: a photo convolved with a gaussian blur kernel of unknown sigma. I would want to deconvolve the blurry image using several gaussian kernels (with different sigmas). Is there some metric function that measures "sharpness" of the deconvolved image? I could have a user look at a sequence of images and pick the most sharp one manually but I would like to have some automated way of doing this. Thus this question.

I imagine that such a sharpness function must exist because modern cameras have auto focus feature. Auto focus adjusts focal lens (is that the right term for it?) based on some sharpness value being a function of a (more of less) blurry image.

I also realize that there is such a thing as blind deconvolution which does not exactly need to know what the point spread function was exactly, but I do not want to get ahead of myself here. But of course, all ideas are welcomed.

$\endgroup$
1
  • $\begingroup$ Welcome to SE.SP! This question over on StackOverflow seems related. $\endgroup$
    – Peter K.
    Jul 1 at 22:05

2 Answers 2

3
$\begingroup$

I don’t know of any method that can measure sharpness in an arbitrary image, and presume it is impossible to distinguish a sharp picture of a smooth color transition form a blurry picture of a sharp color transition.

But comparing sharpness of two images of the same scene is very possible. This is how autofocus in microscopy is typically implemented (but not in consumer or professional cameras though, they use a simpler and faster system that does not require multiple pictures to be taken, you can learn more about that on Wikipedia).

In microscopy, the approach typically employed is computing local variance. Within a small window, compute the variance in the various images. The image that has the highest variance is the sharpest.

Typically you’d compute the variance in multiple windows, and pick the window with the largest variance. This window has an edge in it. You should compare the same window in each of the images, so that you compare apples to apples.

Similar results can be obtained using a Laplacian filter, but I recommend sticking to the variance because it’s the proven method.

$\endgroup$
0
$\begingroup$

If you have an image, you can also calculate its (frequency magnitude in 2-d). A simple sharpening algorithm is just a high-frequency boost filter so it will have a predictable effect on the spectrum.

I.e. look at the spectrum of the input image, decide how you want to modify it, then pick the sharpening kernel that does it. No need to iterate through a number of sharpening kernels and pick the best.

Now, deciding on a target function for the spectrum sounds like a hard task. There is no reason to expect your scene to have a flat spectrum, thus you should not simply pick the degree of sharpening that produce a roughly flat output spectrum.

Perhaps returning to the (non-transformed) spatial domain, picking the N «sharpest, highest contrast edges, and seeing what kernel will make them sharp without too much overshoot (ie assume that they should be perfect step functions) Then some clever guesswork to estimate SNR in order to automatically set unsharp mask thresholding in a Wiener-filter-like manner to avoid excessive noise amplification?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.