Ask Your Question

Detect blur, sharpness of the single image

asked 2016-02-21 04:43:16 -0600

vlad.gorbenko gravatar image

updated 2016-02-21 08:45:28 -0600

I am trying to create validation of the image into my mobile application for different platforms(iOS, Android, etc.) Googled a lot I found some solutions and snippets but unfortunately they are not opaque for me. The idea is take a picture and validate it. For example attached image is not valid.

Is it possible to make this kind of validation using OpenCV? I want to have functions like isBlurry(image), isSharped(image)

sample blurry image ( 0,99 MB ! )

edit retag flag offensive close merge delete


maybe you will support the idea of adding calcBlurriness function to imgproc

sturkmen gravatar imagesturkmen ( 2016-02-21 07:52:09 -0600 )edit

With one image I don't know if an image is blur or not. With two images you can compare values of bluriness but you need to define a region of interest. It's like when you take a picture do you want to see a blur backgound or a blur foreground?

LBerger gravatar imageLBerger ( 2016-02-21 09:07:58 -0600 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2016-02-21 19:27:55 -0600

Tetragramm gravatar image

Take a look at this SO answer.

These aren't absolute measures, but they are relative. So you can use these to tell if one image is blurrier than another.

edit flag offensive delete link more


Thank you. But the question is what to do when you have only one image without comparing.

vlad.gorbenko gravatar imagevlad.gorbenko ( 2016-02-21 23:26:42 -0600 )edit

If you find an answer after you can post an answer to this comment "What if you take a perfectly on-focus picture of a blurred image?" When you measure something all is relative

LBerger gravatar imageLBerger ( 2016-02-22 03:30:47 -0600 )edit

It can actually be done if you have a perfectly sharp edge aligned with either the horizontal or vertical line of pixels. But other than a very few lab condition papers I've never seen it used.

Basically, take a perfect picture, measure the metric immediately surrounding the knife edge, set that to 1.0, and find the knife edge in subsequent images and compare.

Tetragramm gravatar imageTetragramm ( 2016-02-22 07:06:37 -0600 )edit

answered 2018-02-06 02:21:38 -0600

abhijit gravatar image

check this link. This uses variance of laplacian.

edit flag offensive delete link more

answered 2018-02-06 02:44:23 -0600

VxW gravatar image


this paper is also interesting, where they use a Harr Wavlet transform to determine bluriness and sharpness:

Blur Detection for Digital Images Using Wavelet Transform

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-02-21 04:43:16 -0600

Seen: 21,845 times

Last updated: Feb 06 '18