Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-Detecting blurry regions of an image

I am working on images that are partially blur on some sections. These are noises that should be taken care of, but here is the problem:

Are there methods to detect whether an image is blur or partially blur at some sections of an image? For instance, take a look at sample image below:

blur test

You can see in the image that there are 3 sections that are visually blur: bottom-left, near center region and top-right. Now, is it possible to detect that any portion of an image is blur programming-wise or mathematically?

like image 442
Karl Avatar asked Aug 20 '12 14:08

Karl


People also ask

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

The easiest way to detect if an image is blurry or not is to look at the strength of the high frequency content. This can be done with a simple gradient of gaussian filter or a laplacian filter.

What is blur detection?

Blur detection is aimed to differentiate the blurry and sharp regions from a given image. This task has attracted much attention in recent years due to its importance in computer vision with the integration of image processing and artificial intelligence.

What would cause an image to appear blurred?

There are basically five causes of blurry photos: camera movement, subject movement, missed focus, insufficient depth of field, and lens softness.

How do you blur out a region in a picture?

Go to Edit Image in the top toolbar and locate the Blur option under Tools or search for it in the search bar. Use the Auto option to blur your entire image, or select Blur to brush the area you want to blur out. You can also erase the blur by using the Restore brush option.


2 Answers

As lain_b pointed out, with an image like this you can use an edge detector and look for an absence of edges. I tried it on your image and it seems to work pretty well. First I used the kernel

[0,1,0,
 1,-4,1,
 0,1,0]

Which is a simple edge detector. Its result was

enter image description here

Then I used a threshold to get

enter image description here

Then I closed the image and opened it to get

enter image description here

This is obviously not a finished version, the top right portion did not recognize well at all. Perhaps you could improve it by blurring before performing thresholding, or by choosing better values for the threshold and the radii of the opening and closing operations. A lot of the decisions you will need to make depend on the constraints you can put on your problem. I think this technique will work for you though.

Edit If you are looking for blur detection of arbitrary images you are going to have to investigate a wide variety of techniques. Things are much easier if you can make assumptions about your set of input images. Without any assumptions I don't know what will work best for you. Here is some reading on the topic

Image Blur Metrics

Reserach paper on using the Harr wavelet transform

Similar SO Question and look at the question that question links to

Blur detection is a very active research field, there is no one answer. You will just need to try all the methods you can find (these were found by googling detect blur in image).

like image 161
Hammer Avatar answered Nov 14 '22 04:11

Hammer


This paper may be of some help. It does blur estimation (mostly for out of focus, but I think it also does blur) to recreate a similarly blurred object in the image.

I think you should be able to use it to detect the blurred areas, and how blurred they are. It should be especially relevent to your problem as it is designed to work with real-world images.

like image 41
Bill Avatar answered Nov 14 '22 03:11

Bill