Is There a Algorithm or Library that can Detect Motion Blur in Images?

There are multiple ways to do this, maybe one of the imaging gurus here has a much better answer. Anyways...

My first shot would be to have a frequency analysis of the image (read: 2d fourier transform). Then define a threshold for the high frequencies (i.e. fast changes from one pixel to the next) for true/false. Motion blur filters the high frequencies out. Your mileage may vary, e.g. a completely black picture will have no high frequencies although it is not blurred. Depending on the lens and aperture used, parts of the image may be blurry because they are in the background. I don't think there's a one-size-fits-all solution here.


The Discrete wavelet transform is a useful tool in such detection. Here is a paper from Carnegie Mellon School of Computer Science on detecting and quantifying blur in images by using the DWT. For a binary decision, you threshold the amount to a desired level and everything above that has blur.