Image Processing Reference
In-Depth Information
Fig. 4.18 The box is defined
by the threshold values. The
box indicates the region
within the RGB color cube
where object pixels lie
4.4.1 Color Thresholding
Color thresholding can be a powerful approach to segmenting objects in a scene.
Imagine you want to detect the hands of a human for controlling some interface.
This can be done in a number of ways, where the easiest might be to ask the user to
wear colored gloves. If this is combined with the restriction that the particular color
of the gloves is neither present in the background nor on the rest of the user, then by
finding all pixels with the color of the gloves we have found the hands. This operates
similarly to the thresholding operation described in Eq. 4.13 . The difference is that
each of the color values of a pixel is compared to two threshold values, i.e., in total
six threshold values. If each color value for a pixel is within the threshold values,
then the pixel is set to white (foreground pixel) otherwise black (background pixel).
The algorithm looks as follows for each pixel:
If
R>R min
and
R<R max
and
G>G min
and
G<G max
and
(4.14)
B>B min
and
B<B max
Then
g(x,y)
=
255
Else
g(x,y)
=
0
where (R,G,B) are the RGB values of the pixel being processed and R min and
R max define the range of acceptable values of red in order to accept the current pixel
as belonging to an object of interest (similarly for green and blue).
The algorithm actually corresponds to defining a box in the RGB color space and
classifying a pixel as belonging to an object if it is within the box and otherwise
classifying it as background. This is illustrated in Fig. 4.18 .
One problem with color thresholding is its sensitivity to changes in the illumina-
tion. Say you have defined your threshold values so that the system can detect the
two gloved hands. If someone increases the amount of light in the room, the color
Search WWH ::




Custom Search