Digital Signal Processing Reference
In-Depth Information
19.1 Measuring Focus
We all recognize focused and unfocused images when we see
them. Unfocused images are characterized by blurry and difficult
to identify objects, whereas focused images are characterized by
well-defined, easily identifiable objects. Let's take a look at what
we mean by objects appearing blurry: an object that appears
blurry has edges that are “fuzzy”, and the transition from object to
background is gradual. Compare this to a focused image, where
the edges of objects are sharp, and the transition from object to
background is immediate. The effect of focus on edge sharpness
can be seen in Figure 19.1 . We can effectively generate a focus
score for an image or an object within an image by measuring the
sharpness of these edges.
19.1.1 Gradient Techniques
Gradient techniques measure the difference between adjacent
pixel grayscale values, and use this as a measure of rate of change
of grayscale, or gradient of the gray levels. Focused images exhibit
large rates of change in pixel gray level, whereas in an unfocused
image the gray level value's rate of change is lower. Thus we can
measure the absolute gradient of every pixel, sum all the gradi-
ents and use this as a focus score.
F
¼ P y ¼ 0toM 1 P x ¼ 0toN 1 j
i (x þ 1,y)
i (x,y)
j
Where:
F
¼
Focus score
N
¼
Number of pixels in image row
M
Number of pixels in image column
i(x,y)
¼
¼
Image gray level intensity of pixel (x,y)
Figure 19.1. Example of focused
and unfocused images.
Search WWH ::




Custom Search