An easy way to check for blurriness

I'm looking for a “very” easy way to check if a bitmap is blurry. I do not need an exact and complicating algorithm that includes fft, wavelet, etc. Just a very simple idea, even if it is inaccurate.

I thought to calculate the average Euclidean distance between the pixels (x, y) and the pixel (x + 1, y), given their RGB components, and then using a threshold, but it works very poorly. Any other idea?

+3
source share
3 answers

Do not calculate average differences between adjacent pixels.

, , . . , , - .

, , . , , , 10 .

PHP GD (Bokeh_Ipomea.jpg). Sharpness - 255 ( , , , ). , .

close-up of Ipomea flower, sharpness calculated as 71.0%

same image with slight blurring, sharpness is reduced to 36.1%

same image with severe blurring;  sharpness is now 17.6%

, , :


Update:

, , . , (maxdiff) (). :

sharpness = (maxdiff/( + )) * (1,0 + /255) * 100%

- , , . ( 15.)

. , 40%, , . ( 9 × 9 ):

"Pure Linen" by mystuart @ Flickr()

"Blurred Buty" by Ilya @ Flickr()

"Blurry Downtown" by Andy Arthur @ Flickr()

"blurry volcanic mound" by matt Dombrowski @ Flickr()

. , , :

"Clouds and sky" by William Warby @ Flickr()

Bokeh , :

"The Side" by HD41117 @ Flickr()

, , . , , , , , .

+9

, , ... , -, . , . , :

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

(LoG), "" , . .

. MATLAB, :
This is the original image , This is the blurry image, blurred with gaussian noise LoG This is the LoG image of the original LoG This is the LoG image of the blurry image

LoG, :

E  = 1265       E  = 88
 or              bl

...
, , ...

+2

L1- :

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

L2:

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

N2/(N1 * N1) . , .

+1

All Articles