Digital Signal Processing Reference
In-Depth Information
100 and we will firstly calculate the focus score for
the unfocused image, with the blurry edge:
F
We'll set T
¼
800
Note that there is only one difference that is greater than or
equal to T. Since every row is the same, we multiply this one
diference by the number of rows.
Next we will calculate the focus score for the focused image,
with the sharp edge:
F
¼
(250
150)
8
¼
¼
¼
2000
From this calculation we see the focused image has a higher
score. Thus for multiple images of the same scene we have
a method that can identify images with the best focus.
This rate of change also translates to higher frequencies in the
spatial domain, so applying a high-pass filter and then
measuring the power of the filtered image gives an indication of
the total power of the high-frequency components in the image
and thus the focus. Noise within an image can also have high-
frequencycontent:dependingonthesystem,itmaybeneces-
sary to use a band-pass filter that rejects some of these high
frequencies.
(250-0)
8
19.1.2 Variance Techniques
Since the pixel gray values of edges in a focused image tran-
sition rapidly, such images exhibit greater variance in pixel
values. We can measure this by calculating the difference
between each pixel and the mean value of all the pixels. We
square the difference to amplify larger differences, and remove
negative values:
F
(1 / MN) P y ¼ 0toM 1 P x ¼ 0toN 1 (i (x,y) m
) 2
¼
Where:
m ¼
Mean of all pixels.
Let's apply this variance measure to our two images in
Figure 19.2 . First we we'll calculate the mean for the unfocused
image:
m ¼
(250
þ
250
þ
250
þ
150
þ
100
þ
50
þ
0
þ
0)
8/
64
131.25
Next we calculate the variance:
F
¼
131.25) 2
131.25) 2
¼
(1 / 8
8)
(((250
þ
(250
þ
131.25) 2
131.25) 2
(250
þ
(150
þ
131.25) 2
131.25) 2
131.25) 2
þ
þ
þ
(100
(50
(0
131.25) 2)
(0
8)
F
¼
10,586
Search WWH ::




Custom Search