OpenCV blur detection c++

asked 2017-01-06 03:36:06 -0600

daubarris gravatar image

Hello, what I want to do is: (Please note that I am a new user of OpenCV)

At first I want to take a picture and read it (imread)

image description

Then, split it in to grid (for now row and col number doesnt matter)

image description

Finally, I want the code to iterate through each grid element and output blurriness level. Also it would be nice to see it when the code runs in which block the detection is happening.

Now my question is where should I start and if this mechanism is good enough? Also suggestions of learning material?

Thanks in advance

edit retag flag offensive close merge delete

Comments

My idea would be to do a transform to the frequency domain (Fourier or DCT) and check for high-frequency components. I would recommend to use a small sliding window instead of dividing the image in blocks.

There are still some difficulties in this problem: the uniform parts of the image won't be considered in focus; some blocks with a small area in focus will be considered not blurry (almost every block in the image because the bars), and the optical blur ("bokeh") isn't gaussian, so in the out-of-focus areas you can still have high-frequency components (see the border between leaves/sky).

kbarni gravatar imagekbarni ( 2017-01-06 08:56:18 -0600 )edit
1

a paper about your project

LBerger gravatar imageLBerger ( 2017-01-06 09:35:04 -0600 )edit