Simple way to check if an image bitmap is blur

后端 未结 3 705
小蘑菇
小蘑菇 2021-02-03 12:50

I am looking for a \"very\" simple way to check if an image bitmap is blur. I do not need accurate and complicate algorithm which involves fft, wavelet, etc. Just a very simple

3条回答
  •  醉梦人生
    2021-02-03 13:23

    I suppose that, philosophically speaking, all natural images are blurry...How blurry and to which amount, is something that depends upon your application. Broadly speaking, the blurriness or sharpness of images can be measured in various ways. As a first easy attempt I would check for the energy of the image, defined as the normalised summation of the squared pixel values:

         1     2
    E = --- Σ I,     where I the image and N the number of pixels (defined for grayscale)
         N
    

    First you may apply a Laplacian of Gaussian (LoG) filter to detect the "energetic" areas of the image and then check the energy. The blurry image should show considerably lower energy.

    See an example in MATLAB using a typical grayscale lena image:
    This is the original image This is the original image This is the blurry image, blurred with gaussian noise This is the blurry image, blurred with gaussian noise This is the LoG image of the original This is the LoG image of the original And this is the LoG image of the blurry one This is the LoG image of the blurry image

    If you just compute the energy of the two LoG images you get:

    E  = 1265       E  = 88
     or              bl
    

    which is a huge amount of difference...
    Then you just have to select a threshold to judge which amount of energy is good for your application...

提交回复
热议问题