I am working on the blur detection of images. I have used the variance of the Laplacian method in OpenCV.
img = cv2.imread(imgPath)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
value = cv2.Laplacian(gray, cv2.CV_64F).var()
The function failed in some cases like pixelated blurriness. It shows a higher value for those blur images than the actual clear images. Is there any better approach that detects Pixelated as well as motion blurriness?
Sample images:
This image is much clearer but showing value of 266.79
Where as this image showing the value of 446.51 .
Also this image seems to be much clearer but showing value only 38.96
I need to classify 1st and 3rd one as not blur whereas the second one as a blur.
You can try to define a threshold as float, so for every result falling under the threshold == blurry. But if the pixel images shows very high every time, even if not blurry, you could check for another value that is very high. Another way might be to detect focus of the picture.