Novel Approach For Detection and Removal of Moving Cast Shadows Based On RGB, HSV and Yuv Color Spaces Brahim Farou
Novel Approach For Detection and Removal of Moving Cast Shadows Based On RGB, HSV and Yuv Color Spaces Brahim Farou
Brahim Farou
Computer Science Department Badji Mokhtar-Annaba University
P.O. Box 12, 23000 Annaba, Algeria
&
LabSTIC, Guelma University
P.O. Box 401, 24000 Guelma, Algeria
e-mail: [email protected]
Herman Akdag
LIASD, Paris 8 University
93526 Saint-Denis, France
e-mail: [email protected]
Abstract. Cast shadow affects computer vision tasks such as image segmentation,
object detection and tracking since objects and shadows share the same visual mo-
tion characteristics. This unavoidable problem decreases video surveillance system
performance. The basic idea of this paper is to exploit the evidence that shadows
darken the surface which they are cast upon. For this reason, we propose a sim-
ple and accurate method for detection of moving cast shadows based on chromatic
properties in RGB, HSV and YUV color spaces. The method requires no a priori
assumptions regarding the scene or lighting source. Starting from a normalization
1002 B. Farou, H. Rouabhia, H. Seridi, H. Akdag
step, we apply canny filter to detect the boundary between self-shadow and cast
shadow. This treatment is devoted only for the first sequence. Then, we separate
between background and moving objects using an improved version of Gaussian
mixture model. In order to remove these unwanted shadows completely, we use
three change estimators calculated according to the intensity ratio in HSV color
space, chromaticity properties in RGB color space, and brightness ratio in YUV
color space. Only pixels that satisfy threshold of the three estimators are labeled as
shadow and will be removed. Experiments carried out on various video databases
prove that the proposed system is robust and efficient and can precisely remove
shadows for a wide class of environment and without any assumptions. Experimen-
tal results also show that our approach outperforms existing methods and can run
in real-time systems.
1 INTRODUCTION
into intensity [14, 17], chromaticity [4, 7, 18, 19] and physical properties [20]; spatial
characteristics are split into geometry [21, 22, 23] and textures [24, 25].
The importance given to this field has prompted researchers to offer a large
amount of approaches to solve shadow problems in videos. However, the proposed
approaches give results only in very specific and well-defined environments [1]. In
addition, the conditions imposed by the authors for the proper functioning of these
systems restrict their use in wide public environments. Comparative studies in the
literature have shown that the results quality obtained by the spatial characteristics
is higher than spectral characteristics. However, the spatial characteristics consume
much computation time and need more memory space, which limits their use in
real-time and on machines with low power. Conversely, the spectral characteristics
offer high execution speed, but have the inconvenience to be sensitive to change in
light intensity and they give bad results when objects have an intensity or color
like shadow. To avoid the problems outlined above, we propose a novel method for
detecting and removing shadows in video surveillance taken from a fixed camera.
The approach is based on chromatic properties in RGB, HSV and YUV color spaces.
We also implemented Large Region texture-based method (LR) presented by Sanin
et al. [3] and in which they showed that LR method gives better results compared
with proposed methods in literature. The rest of this paper is organized as follows.
Section 2 presents an overview of the shadow model. Section 3 describes in detail
the proposed approach. Comparative experimental results are analyzed in Section
4. Finally, conclusion and perspectives are given in Section 5.
2 SHADOW
• The attached shadow is a region of the object that receives no light. It is located
behind the object, in the area where the light from the source does not arrive.
• The umbra is a region of space where the light rays from the source do not pass
because they are stopped by the object.
• The cast shadow is a region of a screen placed behind an object relative to the
light source and not receiving radius. The size and shape of the cast shadow
depend on the shape, size and position of the object relative to the source, but
also depend on the location and angle of the screen.
• The penumbra is a border area that appears between the illuminated part and
the shade part.
1004 B. Farou, H. Rouabhia, H. Seridi, H. Akdag
Cast Shadow
Attached Shadow
Light Source
Umbra
3 PROPOSITION
The ability to extract moving objects from a video sequence is a crucial issue in many
video surveillance systems. The primary role of image processing operations in such
system is not the correct detection of the object details, but the robust detection of
shapes in motion. Unfortunately, these shapes are generally deformed by their own
shadow. In addition, in dynamic scenes, all pixels of moving objects or shadows
are detected at the same time, shadows and objects share the same visual motion
characteristics. Taking into account of all the considerations mentioned before, we
propose a simple and reliable method able to detect and remove shadows generated
by one or more light sources. Figure 2 shows the overall architecture of our system.
Video
Fragmentation Normalization Edge detection
Preprocessing Dilatation
Background Subtraction
3.1 Preprocessing
Preprocessing involves four steps: First thing to do is segment the video stream into
frames, where each frame represents an image of the video. Then all frames are
normalized to avoid disparities in size among the images taken by different cameras.
In the next step, canny filter is used to detect edges that will serve to segment the
image into a set of connected components and to separate between the attached
shadow and cast shadow. Finally, the size of edges is increased using morphological
to remove any discontinuities.
Initialization:
Split the first image into several equal size areas
Assign a thread for each area
Convert all the image pixels from RGB to HSV
Calculate and store the color histogram of each zone
Initialize the GMM parameters
Iteration
FOR each new frame
Convert all image pixels from RGB to HSV
FOR each area
Calculate the color histogram
Measure the similarity degree between the
calculated histogram and the stored one
If the difference is greater than a threshold T
Memorize the new histogram
Updating the GMM parameters
1006 B. Farou, H. Rouabhia, H. Seridi, H. Akdag
END IF
END FOR
END FOR
In the literature several color spaces have been used to model separately the bright-
ness and chromaticity. Usually, the systems using chromaticity as a criterion for
detecting and removing shadows choose an adequate color space that allows a nat-
ural separation between intensity and chromaticity. In the current process, we use
RGB, HSV and YUV color spaces reported as the most robust among others to de-
tect the shadow [2, 3]. Each color space is presented to better understand its effect
on the shadow.
• RGB color space is the vector space generated by the three primary components
Red, Green and Blue. It is the basic color space. It easily allows switching from
one space to another, but it does not explain the influence of brightness and
saturation on color because their change affects all basic components.
• HSV color space characterizes the colors with more intuitive way, in accordance
with natural color perception. The hue (H) is the name used to describe the
color conveniently associated with a wavelength. Saturation (S) is the color
purity level, which should be between the maximum purity (bright color) and
achromatic (gray level). The value (V) is the color light-intensity measure, which
should be between the absolute black and white.
• YUV color space represents colors by using a luminance component Y, and two
chrominance components U and V. The luminance component Y is a weighted
average of relative human sensitivity to primary colors. The chrominance com-
ponents (U and V) are the contrast blue/yellow and the contrast red/cyan.
YUV color space provides a natural separation between the chromaticity and
brightness.
We conducted several studies and experiments to understand the shadow impact
on colors. The obtained results led to the following remarks:
• Shadows density is the most relevant and the most difficult characteristic for
modeling the shade.
• The shadow depends on the amount of light reflected by the surface on which
the shadow is projected.
• In HSV color space, shadow does not change the hue of the color, but tends to
decrease the value (V) and the saturation (S) components; for example, if a red
object is covered by shadow it becomes dark-red which is darker than red but
remains red.
• The shadow effect on the values of the three components R, G and B in RGB
space disturbs indirectly the values of H and S components in HSV space sup-
Novel Approach for Detection and Removal of Moving Cast Shadows . . . 1007
posed invariant to light intensity change. The changeover from RGB to HSV
color space makes modeling the shadow effect on colors more difficult.
• Using one color space is not enough to express all changes made by adding
shadow on color.
• The value of Y component in YUV color space is the best light-intensity direct
measurement to model the shadow effect.
• The shadows effect on objects causes the same change degree to the three com-
ponents of RGB color space. This condition is necessary but not sufficient to
deduce that there is a shadow.
Proposed solutions:
To detect and remove moving shadows, using a background model as reference is
required. For each new frame we extract moving objects, and then we calculate
the change degree of pixels values for all components in RGB, HSV and YUV color
spaces. This process is guaranteed by calculating the ratio change between pixels
values in the background model (BG) and the pixels values of current frame (F) using
the following empirical equations. The ratio change of R, G and B components in
RGB color space are described by Equations (1), (2) and (3):
RBG − RF
RCR = , (1)
RBG
GBG − GF
RCG = , (2)
GBG
BBG − BF
RCB = (3)
BBG
where (RBG , GBG , BBG ) and (RF , GF , BF ) are the pixels values for red, green and
blue components in RGB color space. The ratio change of hue and saturation in
HVS color space are described by Equations (4) and (5):
where (HBG , SBG ) and (HF , SF ) are the pixels values for hue and saturation compo-
nents in HSV color space. The ratio change of luminance component in YUV color
space is given by Equation (6):
YBG − YF
RCY = (6)
YBG
where (YBG , YF ) are the pixels values for luminance component in YUV color space.
Based on the remarks mentioned above, a pixel is considered part of the shadow if
it satisfies simultaneously the following three rules:
1008 B. Farou, H. Rouabhia, H. Seridi, H. Akdag
|RCR − RCG | < 3 and |RCB − RCG | < 3 and |RCR − RCB | < 3, (7)
4 EXPERIMENTS
4.1 Settings
In-depth comparative works done by Sanin et al. [3] showed that the method based
on large region texture (LR) gives better results compared to other methods. In all
cases, the large region texture-based method performs considerably better than all the
others, obtaining high values for both the detection and discrimination rates in all
sequences. For this reason and to better situate our approach over what exists in the
state of the art, we implemented the LR method which will be used as a reference
method.
detected shadow on the target image and the shadow mask in the neighbor frame.
The sequences of images below show the shadow detection in indoor/outdoor videos
taken under different constraints, noise and light intensity variations.
It is clear to see (Figure 3) that our approach can detect shadows for all moving
objects without any prior assumptions about the nature of the environment or on the
moving objects and produces better results compared to LR method. In frame 275,
one can notice that textures have failed to distinguish between the object and its
shadow. The frame 135 shows that our system can differentiate between cast shadow
and attached shadow, which is not the case in systems based on LR.
In Figure 4, the first video was taken into Guelma University campus in a sunny
day with frequent cloud passage. This phenomenon creates an instant brightness
1010 B. Farou, H. Rouabhia, H. Seridi, H. Akdag
LR Our Approach
Frame 275
Frame 603
Public Park
Frame 853
Frame 135
Frame 165
Campus I
Frame 267
change affecting all background colors. Once again, results show the effectiveness
of this approach and its adaptability to multiple color changes in the background.
The second video was taken into a highway with the same conditions as the first
video. The frames 339 and 347 show that LR method cannot distinct between cast
shadow and attached shadow, and also has completely distorted the moving object
when removing shadows, while our system has perfectly separated the shadow from
object in both frames.
Even in partially dark environments with light reflection effects on the wall and
floor, our method is effective as shown in three frames (Figure 5). Frame 23 shows
that our method differentiates between attached shadow and cast shadow. Therefore
it possesses a superior performance than LR method.
These frames (Figure 6) highlight the ability of our system to detect shadows in
public video databases. The frame 248 shows that the proposed method is able to
Novel Approach for Detection and Removal of Moving Cast Shadows . . . 1011
8 LR8 Our88Approach
8 8
8 8 8 8
Frame8279
8
Highway8I8
8 8 8 8
Frame8320
8
8 8 8 8
Frame8103
8
8 8 8 8
Intelligentroom8
Frame8248
8
8 8 8 8
Frame8253
8
Figure 4. Shadow detection of a single moving object with brightness variations in envi-
ronment
LR Our Approach
Frame 23
Frame 65
Hallway
Frame 136
Frame 249
Frame 339 LR Our Approach
Highway
Frame 347
Frame 87
Frame 335 Frame 128
Campus II
detect completely shadow in the case where the floor color is substantially similar to
shadow color. This scenario is one of the most difficult cases to treat in chromaticity-
based method.
In summary, the qualitative results presented through these experiments show
that our approach is effective without any assumptions on the nature of the envi-
ronment, image quality, and light variations or color. Further, it outperforms LR
method almost in all considered videos.
In order to evaluate quantitatively shadow detection, we used two metrics [1]. The
shadow detection rate η, which indicates how well the algorithm detects shadows.
The shadow discrimination rate ξ, which describes how the system can differentiate
between shadows and foreground pixels. They are evaluated by Equations (10)
Novel Approach for Detection and Removal of Moving Cast Shadows . . . 1013
and (11), respectively. For further evaluation, we also calculated the processing
time per sequence for each method.
T PS
η= , (10)
T P S + F NS
T PF
ξ= (11)
T PF + F NF
where TP is the true positive pixels representing the number of pixels correctly
detected and the FN is the false negative pixels representing the number of pixels
incorrectly detected. Subscripts S and F denote shadow and foreground, respec-
tively. T PF is the correct number of points on foreground objects minus the number
of points on foreground objects marked as shadow. TPS and FNS are calculated
according to ground-truth shadows pixels; T PF and F NF are calculated using
ground-truth objects pixels.
To test and evaluate the performances of the proposed approach in our video
data base (DBD), a ground truth data set is also necessary. Objects ground truth
and cast shadows ground truth are obtained by manually labeling objects and cast
shadows after extracting backgrounds with GMM. During producing ground truth
data set for the captured videos, we noticed that labeling shadows is a hard task to
accomplish accurately especially in the scene where floor or objects color is similar
to shadow. For giving more credibility to tests, all frames are taken randomly to
produce ground truth data set. Public video ground truth for DBA, DBB and DBC
are available respectively in [1, 29, 30].
A selection of well-known methods is compared to our method in terms of quan-
titative measures. Seventeen selected methods were evaluated quantitatively based
on η and ξ.
Table 2 compares the result obtained by our method with results achieved by
the other methods. The experimental results show that our method provides both
a good detection and discrimination rate relative to other methods. However, we
cannot draw deep conclusions because improving shadow detection performance is
proportional to improvement in background subtraction performance.
For rational comparison, we also implemented the LR method using the same
background subtraction method as proposed in our approach. The comparison re-
sults are shown in Table 3. Quantitative results clearly show that the proposed
system allows both good detection with an average of 91.37 % and better discrim-
ination with an average of 95.98 %, which means that our method obtained a gain
of 3.44 % in detection and 7.98 % in discrimination relative to the LR method [3].
We note that there is a drop in performance especially in Highway I and Highway
III videos due to a poor contours detection. The qualitative results also showed this
decreased performance because our system has badly detected edges between the
object and its shadow. In return, the LR method gives good shadow detection with
a stable performance in all cases. However, discrimination is a little weak due to
non-availability of discriminative texture in the treated cases.
1014 B. Farou, H. Rouabhia, H. Seridi, H. Akdag
Table 3. Comparison of the proposed method with LR method in both public and personal
video data base
Novel Approach for Detection and Removal of Moving Cast Shadows . . . 1015
Table 4 shows that our method consumes less time compared to the LR method
although both algorithms have the same operations complexity.
This is due to the extra steps required by the LR method to produce the candidate
shadow regions and to calculate the gradients for each pixel. For further comparison,
we computed the processing time.
Table 4. Processing time calculated in milliseconds per frame for all used video databases
5 CONCLUSIONS
The paper proposes an effective method based on RGB, HSV and YUV color mod-
els to detect and remove shadows of moving objects in both indoor and outdoor
environment and without any prior assumptions on illumination conditions.
In our method, we first applied canny algorithm to detect the boundaries for
objects and shadows. This information is used later as a criterion to separate be-
tween attached and cast shadows. After extracting moving objects with an improved
Gaussian mixture model, we used three criteria calculated in RGB, HSV and YUV
color space to decide if a pixel belongs to shadow or to an object and to remove cast
shadows.
Through the experiments and analysis, our results show an enhancement in
detecting shadows compared to the existing methods. They also show the algorithm
ability to deal with textured surfaces and complex environments which fall beyond
the scope of numerous shadow detection methods.
The low complexity of the proposed algorithms can also save significant process-
ing time for probable use in real time applications. Unfortunately, our method may
fail to detect shadows since the latter is miss classed and considered as attached
shadows if the boundaries cannot be well defined. However, the performance can be
1016 B. Farou, H. Rouabhia, H. Seridi, H. Akdag
improved with a sophisticate edge detection method. Our conclusions are supported
by both quantitative and qualitative experiments on shadow detection carried out
on various video databases.
REFERENCES
[12] Sun, B.—Li, S.: Moving Cast Shadow Detection of Vehicle Using Combined Color
Models. Proceedings of the Chinese Conference on Pattern Recognition (CCPR),
2010, pp. 1–5.
[13] Sofka, M.: Commentary Paper on “Shadow Removal in Indoor Scenes”. Proceedings
of the Fifth IEEE International Conference on Advanced Video and Signal Based
Surveillance (AVSS), 2008, pp. 299–300.
[14] Gallego, J.—Pardàs, M.: Enhanced Bayesian Foreground Segmentation Using
Brightness and Color Distortion Region-Based Model for Shadow Removal. Proceed-
ings of the 17th IEEE International Conference on Image Processing (ICIP), 2010,
pp. 3449–3452.
[15] Amin, R.—Gould, R.—Hou, W.—Arnone, R.—Lee, Z.: Optical Algorithm for
Cloud Shadow Detection over Water. IEEE Transactions on Geoscience and Remote
Sensing, 2013, Vol. 51, No. 2, pp. 732–741.
[16] Bian, J.—Yang, R.—Yang, Y.: A Novel Vehicle’s Shadow Detection and Removal
Algorithm. Proceedings of the 2nd International Conference on Consumer Electronics,
Communications and Networks (CECNet), 2012, pp. 822–826.
[17] Yu, H.-Y.—Sun, J.-G.—Liu, L.-N.—Wang, Y.-H.—Wang, Y.-D.: MSER
Based Shadow Detection in High Resolution Remote Sensing Image. Proceedings of
the International Conference on Machine Learning and Cybernetics (ICMLC), 2010,
Vol. 2, pp. 780–783.
[18] Song, X.—Ding, Y.—Gen, J.—Chen, Y.: Shadow Removal of Vehicles in a Video
System Based on RGB Chroma Model. Proceedings of the International Conference
on Computer Science and Software Engineering, 2008, Vol. 1, pp. 977–980.
[19] Yang, Q.—Tan, K.-H.—Ahuja, N.: Shadow Removal Using Bilateral Filtering.
IEEE Transactions on Image Processing, 2012, Vol. 21, No. 10, pp. 4361–4368.
[20] Makarau, A.—Richter, R.—Muller, R.—Reinartz, P.: Adaptive Shadow
Detection Using a Black Body Radiator Model. IEEE Transactions on Geoscience
and Remote Sensing, 2011, Vol. 49, No. 6, pp. 2049–2059.
[21] Panagopoulos, A.—Wang, C.—Samaras, D.—Paragios, N.: Simultaneous
Cast Shadows, Illumination and Geometry Inference Using Hypergraphs. IEEE
Transactions on Pattern Analysis and Machine Intelligence, 2013, Vol. 35, No. 2,
pp. 437–449.
[22] Xu, M.—Lu, L.—Jia, T.—Ren, J.—Smith, J.: Cast Shadow Removal in Motion
Detection by Exploiting Multiview Geometry. Proceedings of the IEEE International
Conference on Systems, Man, and Cybernetics (SMC), 2012, pp. 762–766.
[23] Fang, L. Z.—Qiong, W. Y.—Sheng, Y. Z.: A Method to Segment Moving Vehicle
Cast Shadow Based on Wavelet Transform. Pattern Recognition Letters, Vol. 29,
2008, No. 16, pp. 2182–2188.
[24] Leone, A.—Distante, C.: Shadow Detection for Moving Objects Based on Texture
Analysis. Journal of Pattern Recognition Society, Vol. 40, 2007, No. 4, pp. 1222–1233.
[25] Leone, A.—Distante, C.—Buccolieri, F.: A Shadow Elimination Approach
in Video-Surveillance Context. Pattern Recognition Letters, Vol. 27, 2006, No. 5,
pp. 345–355.
1018 B. Farou, H. Rouabhia, H. Seridi, H. Akdag
[40] Jung, C.: Efficient Background Subtraction and Shadow Removal for Monochro-
matic Video Sequences. IEEE Transactions on Multimedia, 2009, Vol. 11, No. 3,
pp. 571–577.
[41] Zhang, W.—Fang, X. Z.—Yang, X.—Wu, Q. M. J.: Moving Cast Shadows De-
tection Using Ratio Edge. IEEE Transactions on Multimedia, 2007, Vol. 9, No. 6,
pp. 1202–1214.
[42] Siala, K.—Chakchouk, M.—Chaieb, F.—Besbes, O.: Moving Shadow Detec-
tion with Support Vector Domain Description in the Color Ratios Space. Proceedings
of the 17th International Conference on Pattern Recognition (ICPR), 2004, Vol. 4,
pp. 384–387.
[43] Song, K.-T.—Tai, J.-C.: Image-Based Traffic Monitoring with Shadow Suppres-
sion. Proceedings of the IEEE, 2007, Vol. 95, No. 2, pp. 413–426.
[44] Martel-Brisson, N.—Zaccarin, A.: Kernel-Based Learning of Cast Shadows
from a Physical Model of Light Sources and Surfaces for Low-Level Segmentation.
Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition
(CVPR), 2008, pp. 1–8.
[45] Celik, H.—Ortigosa, A.—Hanjalic, A.—Hendriks, E.: Autonomous and
Adaptive Learning of Shadows for Surveillance. Proceedings of the Ninth Interna-
tional Workshop on Image Analysis for Multimedia Interactive Services (WIAMIS),
2008, pp. 59–62.
[46] Choi, J.—Yoo, Y. J.—Choi, J. Y.: Adaptive Shadow Estimator for Removing
Shadow of Moving Object. Computer Vision and Image Understanding, Vol. 114,
2010, No. 9, pp. 1017–1029.