Image Processing Reference
In-Depth Information
The programming example primarily consists of two FOR-loops which go
through the image, pixel-by-pixel, in the order illustrated in Fig. 4.28 . For each
pixel, a point processing operation is applied.
Below we show what the C-code would look like if the operation in Eq. 4.3 were
implemented.
for
(y = 0;
y < M;
y = y + 1)
{
for
(x = 0;
x < N;
x = x + 1)
{
value
= a
GetPixel ( input ,
x ,
y)
+ b;
SetPixel ( output ,
x,
y,
value );
}
}
where a and b are defined beforehand.
Below we show what the C-code would look like if the operation in Eq. 4.13
were implemented.
for
(y = 0;
y < M;
y = y + 1)
{
for
(x = 0;
x < N;
x = x + 1)
{
if
( GetPixel ( input ,
x ,
y)
> T)
SetPixel ( output ,
x ,
y ,
255);
else
SetPixel ( output ,
x,
y,
0);
}
}
where T is defined beforehand.
4.8
Further Information
Thresholding is a key method in many video processing systems. Please remem-
ber that there is a direct relationship between your image acquisition process, your
setup and your choice of threshold value. If the methods described in this chapter
are not sufficient, please bear in mind that other methods for especially automatic
thresholding exist.
A very popular use of color thresholding is to segment objects (especially people)
by placing them in front of a unique colored background. The object pixels are then
found as those pixels in the image which do not have this unique color. This principle
is denoted chroma-keying and used for special effects in many movie productions
as well as in TV weather-forecasts, etc. In the latter example the host appears to
Search WWH ::




Custom Search