Blur detection explained: what the score means
Blur detection is the automated measurement of how sharp an image is, producing a single numeric score that gets compared against a threshold to decide whether a photo is usable or should be shot again. It is the most common component of image quality validation, and the narrowest.
How does blur detection work?
The standard method is older and simpler than most people expect. A sharp image has abrupt intensity changes at object edges. A blurred one has gradual ones. Apply a Laplacian operator, which responds to those second-order intensity changes, then take the variance of the result. High variance means strong edges and a sharp image. Low variance means the edges have smeared out.
This variance-of-Laplacian measure comes out of microscope autofocusing research, notably Pech-Pacheco and colleagues at ICPR 2000, in a comparative study of autofocus methods for diatom imaging. The paper's stated requirements were speed, sharpness response and resistance to noise, and the same measure is still what sits behind a great many production blur checks a quarter of a century later. It is a handful of lines of code, which is a large part of its appeal.
More elaborate approaches exist. No-reference quality models such as BRISQUE and NIQE, from Mittal and co-authors in 2012, score general image degradation using natural scene statistics rather than testing edges directly, and learned models can distinguish motion blur from defocus blur. All of them still output a number that needs a threshold.
The threshold problem
The variance score has no absolute meaning. Its value depends on image content, resolution, lighting and compression, which creates a set of predictable errors:
- Low-texture subjects score low while perfectly sharp. A flat white panel, a clear sky, a plain painted wall. Few edges exist, so few edges are detected, and the image is failed as blurry.
- Busy subjects score high while genuinely soft. Gravel, foliage, a textured carpet. Enough residual edge energy survives the blur to clear the threshold.
- Resolution shifts the scale. The same scene at a different capture resolution produces a different score, so a threshold tuned on one device class misfires on another.
- Partial blur is invisible to a whole-image score. A photo that is sharp on the background and soft on the one component that mattered averages out to an acceptable number.
That last one is the expensive failure. Autofocus systems lock onto whatever is contrasty and central, which is very often not the small detail the submission is actually about.
Blur detection: a worked example
A technician photographs a hairline crack across a casting. The autofocus grabs the bright machine housing behind it. The image scores well above the sharpness threshold, passes the gate, and reaches a reviewer who cannot make out the crack at all. Every check ran correctly and the photograph is still unusable for the only purpose it had.
Blur detection compared with image quality validation
The two are often used interchangeably and should not be. Blur detection tests one property, edge sharpness. Image quality validation is the broader gate that may also test exposure, resolution, contrast, framing and obstruction. A photo can be flawlessly sharp and still be too dark, too small, or cropped so tightly that the context is gone.
And neither of them, at any threshold, can tell you whether the correct subject was photographed. A crisp, well-lit, well-framed picture of the wrong asset passes every technical test that exists. This is the boundary worth being clear about internally, because "we validate image quality" is very easily heard by a non-technical stakeholder as "we check the photos are right." Those are different claims.
Using blur detection well
A few things reliably help:
- Score the region of interest, not the frame. If you know roughly where the subject should be, measure sharpness there.
- Calibrate on your own images. Take a few hundred real submissions, have someone label usable and unusable, and pick the threshold that separates them. Do not inherit a number from a tutorial.
- Check during capture, not after. A prompt while the person is still standing in front of the subject costs seconds. A retake request the next day costs a day.
- Fail open on the ambiguous middle. Rejecting a usable photo of a low-texture surface annoys the person capturing and teaches them to ignore the system.
Treat the score as a cheap first filter that catches the obviously unusable, and expect the harder judgements to stay with the reviewer looking at the photo evidence itself.