File Exchange

image thumbnail

Image Blur Metric

version (1.79 KB) by Do Quoc Bao
Measure the blur level of still image.


Updated 09 Jul 2009

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

original : entry image

The idea is from "The Blur Effect: Perception and Estimation with a New No-Reference Perceptual Blur Metric"
Crété-Roffet F., Dolmiere T., Ladret P., Nicolas M. - GRENOBLE - 2007
In SPIE proceedings - SPIE Electronic Imaging Symposium Conf Human Vision and Electronic Imaging, États-Unis d'Amérique (2007)

Written by DO Quoc Bao, PhD Student in L2TI Laboratory, Paris 13 University, France

Cite As

Do Quoc Bao (2021). Image Blur Metric (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

Saurabh Bagalkar

This does not seem to work when the image is way to blurry to begin with.Like for example, If I have an extremely blurry image( say 50x50 kernel of averaging filter vs 45x45 filter), ideally we should get a higher value of blur metric for the image blurred 45x45 as it is more in-focused , but that is not the case. I am trying to find the edge cases for this algorithm as I am using this code and it fails in certain edge cases.Anyone can help?

Benjamin Keane

Kameron Rausch

There are a few things that should be changed in this file.
1) The im filter functions on lines 24 and 25 should have the option 'replicate' to avoid boundary errors in the smoothing which biases the deltas calculated in lines 30-31.
2) The vertical and horizontal smoothing filters are swapped. You can tell this by looking at the intermediate images. B_Ver for example is blurred in the horizontal direction.
3) And lastly a note: lines 39-43 do not sum over the whole array like the paper does.
4) The input expects a luminance image. It would be nice to check if image is a luminance image and if not, convert it automatically.


Hi I wanted to know by "still image" do you mean image that has not been slurred yet?

maryam jfri

sachin rathod

can i use this code for depth of field concepts... it can find the blur factor ..thanks

sachin rathod

can i use this code for finding depth of field

Karthik MSwamy

Quite an effective metric for measuring blur! Comments and explanation of the code helped.

Andrej Karpathy

Worked very well for me! Thank you very much!

dai zhengguo

good job! The author is very kind to explain the code for me. Thank you again

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!