Simple way to check if an image bitmap is blur

后端 未结 3 748
小蘑菇
小蘑菇 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:43

    calculate the average L1-distance of adjacent pixels:

    N1=1/(2*N_pixel) * sum( abs(p(x,y)-p(x-1,y)) + abs(p(x,y)-p(x,y-1)) )
    

    then the average L2 distance:

    N2= 1/(2*N_pixel) * sum( (p(x,y)-p(x-1,y))^2 + (p(x,y)-p(x,y-1))^2  )
    

    then the ratio N2 / (N1*N1) is a measure of blurriness. This is for grayscale images, for color you do this for each channel separately.

提交回复
热议问题