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

后端 未结 12 1896
予麋鹿
予麋鹿 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 15:05

    Thanks nikie for that great Laplace suggestion. OpenCV docs pointed me in the same direction: using python, cv2 (opencv 2.4.10), and numpy...

    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) numpy.max(cv2.convertScaleAbs(cv2.Laplacian(gray_image,3)))

    result is between 0-255. I found anything over 200ish is very in focus, and by 100, it's noticeably blurry. the max never really gets much under 20 even if it's completely blurred.

提交回复
热议问题