Ask Your Question

Detect blur image

asked 2012-10-17 15:47:22 -0500

tuyau2poil gravatar image

Hello, I would like to check blurring on a lot of medical pictures (more than 10000). (the goal is to remove bad files). is it possible ? if yes, can someone give me a simple way to do that ? I'm not a guru in image analysis, and I spent days to look for that kind of tool. I use visual studio to compile numerous c++ files like thislink text but c++ is not my favorite language (nor english! :-) ) and I can't understand the mixing complexity of all this mathematical technology... thank you ! Alan / France'countrySide

edit retag flag offensive close merge delete


Kirill Kornyakov gravatar imageKirill Kornyakov ( 2012-10-18 12:13:07 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2012-10-18 04:41:54 -0500

Ben gravatar image

That's a difficult task. Cameras can change the focus and thus analyse, if the image gets sharper or not. Having only one picture, how can you decide if your image is blurred or if it is a perfectly sharp photo of a Gerhard Richter painting?

Basically, sharpness can be measured by analysing the edges, for example with a Sobel filter. Having strong edges is a good sign for sharpness. But if you don't have high contrasts in your image, it could also mean that you took a picture of something lacking contours.

The good thing is: you probably know, what's represented on your pictures. If you're expecting certain objects, it is easier to define some threshold which classifies the image as blurred or sharp.

edit flag offensive delete link more

answered 2012-10-19 16:36:20 -0500

tuyau2poil gravatar image

Thanks you very much for your answers : I finaly use Laplacian/gauss filter and get stronger pixel to estimate blur : it's Ok for my need. I translate C++ code to VB.Net and use EMGU Opencv library. this is my code :

Module Module1
Private Sub GetBlur(ByVal imgfile As String)
    Dim factor As Single
    Dim imgB As Bitmap = New Bitmap(imgfile)
    imgB = New Bitmap(imgB)
    Dim imgGray As Image(Of Gray, Byte) = img.Convert(Of Gray, Byte)()
    Dim imgTmp As Image(Of Gray, Single) = imgGray.Laplace(1)
    Dim maxLap As Short = -32767
    For Each MyByte As Single In imgTmp.Data
        If MyByte > maxLap Then
            maxLap = MyByte
        End If
    Debug.Print(imgfile & "   " & maxLap)
End Sub

End Module

Where Maxlap is the "blur score" of the picture.


edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2012-10-17 15:47:22 -0500

Seen: 17,284 times

Last updated: Oct 19 '12