Is there a way to detect if an image is blurry?

后端 未结 12 1937
予麋鹿
予麋鹿 2020-11-22 14:48

I was wondering if there is a way to determine if an image is blurry or not by analyzing the image data.

12条回答
  •  孤独总比滥情好
    2020-11-22 15:15

    Yes, it is. Compute the Fast Fourier Transform and analyse the result. The Fourier transform tells you which frequencies are present in the image. If there is a low amount of high frequencies, then the image is blurry.

    Defining the terms 'low' and 'high' is up to you.

    Edit:

    As stated in the comments, if you want a single float representing the blurryness of a given image, you have to work out a suitable metric.

    nikie's answer provide such a metric. Convolve the image with a Laplacian kernel:

       1
    1 -4  1
       1
    

    And use a robust maximum metric on the output to get a number which you can use for thresholding. Try to avoid smoothing too much the images before computing the Laplacian, because you will only find out that a smoothed image is indeed blurry :-).

提交回复
热议问题