SHADOW DETECTION USING COLOR AND EDGE INFORMATION

Shadows appear in many scenes. Human can easily distinguish shadows from objects, but it is one of the challenges for shadow detection intelligent automated systems. Accurate shadow detection can be difficult due to the illumination variations of the background and similarity between appearance of the objects and the background. Color and edge information are two popular features that have been used to distinguish cast shadows from objects. However, this become a problem when the difference of color information between object, shadow and background is poor, the edge of the shadow area is not clear and the shadow detection method is supposed to use only color or edge information method. In this article a shadow detection method using both color and edge information is presented. In order to improve the accuracy of shadow detection using color information, a new formula is used in the denominator of original c 1 c 2 c 3 . In addition using the hue difference of foreground and background is proposed. Furthermore, edge information is applied separately and the results are combined using a Boolean operator.


INTRODUCTION
Applications such as traffic monitoring and analysis, automatic surveillance systems and counting vehicles require an accurate method to detect foreground objects from a sequence. Of the different methods, background subtraction is a common method for detecting objects ( Bevilacqua, 2003;Matusek et al., 2009). However, in real applications it is difficult to obtain a pure object image because of the existence of shadow which is often mistaken as an object ( Wang, 2009). The detection of shadows can be difficult due to variation in illumination and the similarity between the appearance of the foreground and the background images.
Shadows cause serious problems in tracking, segmentation, localization, object recognition and classification of objects. These problems include the misclassification of background and foreground objects, the merging of objects, changing the shape and color of objects and missing objects. For example, image segmentation methods often cannot resolve two separate objects because of a shadow cast in between them and tend to detect the two objects as one object. In addition, sometimes shadows are categorized as a separate object ( Park and Lim, 2009).
There are some properties extracted from images which can be used to distinguish between an object, the background and shadow. These properties are listed as following.
A shadow has a lower brightness (illumination) in comparison to the background pixels (a shadow is semitransparent) and this difference changes smoothly between neighboring pixels ( Kumar and Kaur, 2010;Chen and Aggarwal, 2010).
All Red-Green-Blue (RGB) values of a shadow are lower than the background in the corresponding pixel. In Hue-Saturation-Value (HSV) colour space, the hue and saturation components of shadow pixels are a bit smaller than the background.

JCS
Shadow pixels have a lower grey-level (intensity, chromaticity, saturation) from the object and background ( Sanin et al., 2010;Zhang and He, 2010) therefore, the local max value of the shadow area is expected to be small. In contrast, the object and background often have values with high intensities and the local max value is expected to be large ( Zhu et al., 2010): • The shadow and the background have the same texture. While the object is texture-rich, a shadow has little texture (texture-less) ( Kumar and Kaur, 2010;Sanin et al., 2010) • Both a shadow and the background are illuminated by different lights. Shadows illuminated by indirect lights while background illuminated by direct light • A shadow has lower boundaries compared to a background • An object has acceptable interior edges. In comparison, the shadow region does not have many interior edges. Plus, the exterior edge of a cast shadow is connected to the edges of an object ( Panicker and Wilscy, 2010) • While the shadow and object have same motion, their locations are different ( Zhang and He, 2010) • Skewness in shadow areas and in non-shadow regions is different, which is a good cue for locating shadows ( Zhu et al., 2010) • The distribution of image gradient values is often invariant across shadow boundaries. The similarity between the distributions of a set of first order derivatives of Gaussian filters in neighbouring segments of the image can be used, to capture gradient values ( Zhu et al., 2010) • A shadow has a different entropy value compared to that of near black objects (Zhu et al., 2010) The different properties of a shadow, background and object are compared in Table 1. In this table, different features of shadows which can be extracted from the images are listed and their values are compared in a background image or an object.
Color and edge information are two popular features that have been used to distinguish cast shadows from objects. Color information is useful because information such as hue in HSI color model, Y in YC b C r color model, the gradient of red, green and blue channels in RGB color model are invariant in both shadow area and background, but information like intensity is different. Besides, the useful information for shadow detection is the cast shadow that does not have exterior edges. However, this become a problem when the difference of color information between object, shadow and background is poor, the edge of the shadow area is not clear and the shadow detection method is supposed to use only for color or edge information method.
In this study, a combined method for shadow detection is introduced. The color information and edge information are used to detect shadow pixels. Synthesizing the results by Boolean operator and removing the existent noise are the next steps. Quantitative results show the improvement of the accuracy of the proposed method.
The rest of this study is organized as follows. In the first section, recent related works are reviewed. In the next section, the proposed method is introduced. Experimental results forms the next section and concluding remarks are given in the last section.

Related Works
Shadow detection techniques can be classified by their features as following: • The Geometrical (Model Based, Shape Based) Techniques • The Texture (Spatial Based) Techniques • The Statistical (Physical) Techniques • The Grey-Scale Based Techniques • The Image (Property Based) Techniques • The Color (Spectrum Based) Techniques Each of these techniques has its own assumptions and conditions in order to work well. In the following subsections, the conditions under which each of these techniques work well or produce accurate results are investigated and some examples are given.

The Geometrical Techniques
The geometrical model is based on matching sets of geometric features such as lines, corners of 3D object models or edges ( Panicker and Wilscy, 2010). These methods rely on geometric information for the scene and objects and the illumination of the scene, such as the sensor or camera location, the light source direction, the ground surface and the object geometry ( Kumar and Kaur, 2010). The model based methods which are based on geometric information can detect shadows effectively in limited and simulated environments because of the geometric relations between objects and scenes ( Lin et al., 2010;Zhou and Xiaobo, 2010). Besides, all the geometrical models strongly depend on the geometrical relationship between the objects in the scenes and when the geometrical relationships change, these methods can no longer be effective ( Sun and Li, 2010;Zhang and Wu, 2010). In addition, this is not suitable for spatial real-time cases due to the heavy computational load ( Lin et al., 2010). As an example of this kind of methods, foreground segmentation is done by noise level adapted method in Wei-Gang and Bin (2010). In their research, Foreground is segmented using Multi-level histogram thresholding. To find out a region is shadow or not, intensity ratio test, gradient magnitude test and gradient direction test are done. Zhang and He (2010) using combination of Normalized Cross-Correlation (NCC) and frame differences, shadow is removed.

JCS
Panicker and Wilscy (2010) used optical gain matrix to detect and remove shadows. Edges of shadow are removed by geometric scanning and holes of object are filled using foreground's skeleton.

The Texture Techniques
This model is based on the fact that the texture of objects is different from the texture of the background, while the texture of a shadowed region remains the same as the background and this is distributed uniformly ( Kumar and Kaur, 2010;Lin et al., 2010;Zhang and Wu, 2010). The texture model gives more accurate results under stable illumination conditions such as indoor environments without the color information. However, in outdoor scenes, the texture information cannot be captured by edge information, therefore, the performance will be reduced. Moreover, the texture model gives the poorest results for textureless objects. In addition, the texture method does not have a significant performance when the assumption of the algorithm concerning the shadow is not preserved (Lin et al., 2010;Vargas et al., 2010). Furthermore, this technique is difficult in implementation ( Zhang and Wu, 2010). Zhou and Xiaobo (2010) extracts foreground pixels using some edge-based and gray-level based features. Also, in their method, by feature combination, final result is obtained.

The Statistical Techniques
This method estimates the illumination and reflection components according to the intensity of a pixel and the intensity of its neighboring pixels. By using the probabilistic function from the illumination model, this can determine whether a pixel is shadow or not (Lin et al., 2010;Zhang and Wu, 2010). In statistical methods, the selection of the parameters is critical. According to the parameters and their assumptions, this method can be divided into two approaches, parametric and nonparametric ( Panicker and Wilscy, 2010). Spatial and temporal information are used to model the behavior of a pixel in parametric methods. On the other hand, in non-parametric algorithms only the information derived from the input data is taken into account. Generally, selecting the parameters is a crucial problem for this method. One way to select the parameters is using a training set. In fact, the statistical model is an ill-conditioned problem and the computational cost of this method is high (Zhang and Wu, 2010).
To characterize the shadow properties, (Sanin et al., 2010) proposes a multi-cue shadow descriptor. Their method uses log-polar coordinates to find pixels' locations and then using binary classification (RBF kernel Support Vector Machine), linear classifier and 2D spatial filter, shadow was detected and is removed. Yuan et al. ( 2010) introduces a nonparametric frame work. They assign Science Publications JCS a weight to each potentially shadow pixel. Using spatiotemporal context, expected shadow value is computed. In their method, shadow pixel is real if expected and assigned values are equal.

The Gray-Scale Based Techniques
Color images provide much richer information. However, color information is not always available since black and white cameras are more sensitive in low illumination conditions and have a higher resolution. Moreover, by using only grey scale information, significant computational time can be saved ( Vargas et al., 2010). In such cases when only luminance information is available, comparison between the current frame and the background using textures, quotients or correlations can be used for shadow detection ( Lin et al., 2010;Vargas et al., 2010).
The main problem of textures is in its high computational cost. Gradient images of the current image and the background can derive texture measurement. Other measurements are based on Local Binary Patterns (LBP) but these measurements have high noise sensitivity ( Vargas et al., 2010). An image quotient (current image over background) is another way to detect shadows because this remains almost constant (with a small standard deviation) in those areas where shadows are cast and this has a linear intensity variation. Finally, correlation between the same surface of a background with and without shadows can be used for shadow removal ( Vargas et al., 2010). Briefly, the main disadvantages of these kinds of methods are their reliance on synthetically generated training ( Zhu et al., 2010). Fredembach and Susstrunk (2010) obtains edge density from quotient image (current frame over background model). Zhang and Wu (2010), it is proved that normalized eigenvalue is illumination invariant. Shadow pixels are classified by a significant test over pixels. Zhang and He (2010) creates a mask using chromatic information and then gradient information is applied to remove foreground pixels. A shadow variant and shadow invariant cue proposes in Sun and Li (2010) and makes the use of illumination, textural and odd order derivation pixel characteristics.

The Image-Based Techniques
An image based model relies on shadow properties such as color (intensity), brightness, shadow structure and edges. This does not have any assumption about the scene structure ( Kumar and Kaur, 2010). Depending on their type of information, image-based algorithms can be classified into two categories, namely parametric and automatic. Parametric algorithms include a shadow mask and automatic algorithms that have additional assumptions about the scene. The latter is a gradientbased method, in which the edges will be obtained to detect shadows in grey scale images where the illumination is invariant. Despite their simplicity, these methods often work well if the shadow region is not textured at all or texture-less. However, this method loses its effectiveness if the illumination changes and the shadow of one object overlaps into another object (Fredembach and Susstrunk, 2010;Lalonde et al., 2010).
The method proposed in Panicker and Wilscy (2010) uses edge information to remove shadows. First, foreground region is segmented. Then, edges and interior edges of foreground sections are obtained and foreground region is classified. Finally, shadow is detected by subtraction foreground from the image. In another study the Gaussian mixture model is used in Kurahashi et al. (2010). In this research, the Dirichlet Process EM method estimates necessary parameters of the method. Finally, shadow is detected using probability density of shadow model.

The Color Techniques
The color technique is based on the fact that the color tune values of a shadow region are the same as the values in the background while the intensity values are different ( Zhu et al., 2010). This technique attempts to find the color features that are illumination invariant using the color differences in the shadowed region and image and employs the spectral information of the foreground region, background region and shadow region to detect shadows ( Sun and Li, 2010;Kumar and Kaur, 2010;Lin et al., 2010). The color techniques are useful for the color information in the HSV color space and RGB color space ( Zhou and Xiaobo, 2010). The weakness of this approach appears more when the objects have a similar intensity or brightness as the shadows or when the color of the objects is the same as the color of the background region or even when the objects are darker than the background. In these cases, the foreground pixels will be misclassified as shadow pixels or holes will be created within the object ( Panicker and Wilscy, 2010). Overall, by converting color spaces, this is difficult to detect all shadow pixels stably ( Kurahashi et al., 2010). In addition, since color is the primary cue to identify a shadow pixel in color images, this technique might not Science Publications JCS work with black and white images (Lin et al., 2010;Zhang and Wu, 2010). Zhu et al. (2010), the ratio of color channels over Near Infrared (NIR) image is used. Their method is automatic and reliable for mosaiced images. Also, Sun and Li (2010) proposed a combined color model using the ratio of hue over intensity in HSI color model and photometric color invariant c 1 c 2 c 3 color model.
Overall there are five different kinds of information to detect shadows namely, texture information, temporal information, grey scale information, color information and edge information. Texture information such as Local Binary Pattern (LBP) is only helpful to detect foreground objects which are a combination of the objects and shadow areas. It means this method is not able to distinguish the objects from the shadows. Due to this disability, this kind of information does not preserve affective information for the shadow detection process. Note that this study is going to detect shadow pixels from objects. As the second utilized information in the shadow detection process, the temporal information is also able to detect motions in an image where each motion is a combination of both an object and a shadow area and again this method does not provide valuable information either. Another kind of information to detect the shadow pixels is the color information. The color tune values, as colour information, present valuable information to detect shadows that cannot be obtained using the grey scale information. As a result, the color information is selected and the grey scale information is omitted in this study. Last but not least, use of edge information is based on the fact that shadow boundaries are strict and connected to the object while the edges are faint next to the background. Therefore, this information is helpful to detect shadows. As a conclusion, from the explained five types of information, color information and edge information are selected in this research.

Proposed Method
The proposed method is a combination of extended color based method and extended edge based method presented in 2010 ( Sun and Li, 2010;Panicker and Wilscy, 2010). The difference between this and the reference ones is that firstly, it is a combination of them combining the results of each part based on the situation. Secondly, the number of used color features in the color based method has been increased. Finally, an enhancement has been done in the edge based method.
The extended method is based on the extracting shadow pixels from a combination of color information and edge information techniques. Four different color features are selected to detect shadow properties of an input image and Sobel operator is chosen to find the boundaries of the binary, foreground and background images. Post processing is done to synthesize the results as well as to remove the existent noise. Figure 1 shows the proposed method flowchart. In continue, each of the steps which are mentioned in this figure is described in detail.

Shadow Detection Using Color Information
In the proposed method to detect shadow pixels using the color information, first the Hue-Saturation-Intensity (HSI) color space, extended gradual C1C2C3 color space, YCbCr (Luminance, Chroma Blue, Chroma Red) color space and the hue difference of the background and the foreground regions are extracted from an input image. These color features are selected due to their remarkable difference between the shadows, background and object pixels. The shadow pixels based on each of these calculated features are detected separately. Then the results are combined using a Boolean operator (logical AND) to construct the shadow image based on the color information. Figure 2 shows the proposed shadow detection method using color information.

The HSI Color Space
This color space can reflect the fact that the intensity of a shadow region is lower than the intensity of an object region. The RGB color space converts into the HSI color space using Equation (1) Fig. 1. The shadow detection method R, G and B are Red, Green and Blue components of RGB color space, respectively. An example of HSI color space is shown in Fig. 3b The original RGB image of this figure is shown in Fig. 3a.
The ratio of Intensity over Hue is computed to enhance the hue property of the shadow pixels with low luminance. This value is much smaller for shadow pixels than the object pixels. Therefore comparing this value with a user defined threshold detects some primary shadow pixels. This threshold is obtained regarding to the number of objects in the scene and should be between zero to one, so that when there are zero or one object in the foreground image this value is set to 0.0001 and when more than one objects exist in the foreground image it set to 0.05.
But the HSI color model can only distinguish the pixels with large intensity value from the low intensity pixels which is not effective for all pixels. So, other color spaces are used to cover the lack of comprehensive shadow detection ability.

The Extended Gradual C 1 C 2 C 3 Color Model
The extended gradual C 1 C 2 C 3 color model is one of the photometric color invariants. Photometric color invariants are functions which describe color configuration of each image pixel discounted by the shadows. These functions can be adapted to variable illumination conditions therefore this seems that using the extended gradual C 1 C 2 C 3 color model can detect shadow pixels in both indoor and outdoor environments. To convert the RGB color space into the extended gradual C 1 C 2 C 3 color space, the following equation is used: The original C 1 C 2 C 3 color model in Equation (2) is related to ( Sun and Li, 2010). In the proposed extended gradual C 1 C 2 C 3 color model, the denominator is changed from "MAX (B,G)" to "

JCS
values is omitted while all the three channels provide valuable information to detect shadows. Furthermore for example in c1, tan -1 shows the angle between vector R and the plane which is drawn by vectors B and G. The best way to represent the corresponding plane is using hypotenuse of the plane which is shown by Euclidean distance. Plus the results certify this hypothesis Equation 3: (3) Figure 3d shows an example of this color space. The extended gradual C 1 C 2 C 3 color model of the foreground image and the background image are obtained. The difference of the extended gradual C 1 C 2 C 3 color image for the foreground image and the background image is calculated which shows the spectral property of shadows. Then the mean value and the standard derivation of each component are computed separately. In the next step, shadow pixels classification is done using a threshold that is assigned to 1.5 multiply standard derivations ( Sun and Li, 2010).

The YC b C r Color Model
YC b C r color space is shown in Fig. 3c and this color space is free from any assumption and is used by Jin and Feng (2010) where Y component shows the brightness, Cr is the difference of the Red component from Y channel (R-Y) and indicates to difference of the Blue component from the Y component (B-Y).
In this color space the ratio of Cr over Y is obtained for foreground pixels according to Equation (4). This is done to increase the accuracy of the proposed method. The denominator is increased by one to avoid dividing by zero. The RGB Color space converts into the YC b C r color space by Equation (5). The utilized threshold is obtained regarding to the ratio of triple components of RGB and should be assigned in between one to ten. In our experiments the calculated values for this threshold do not follow a clear roll but the threshold values in outdoor images are bigger than the threshold values in indoor images:

The Hue Component Difference of the Foreground and Background
Form the literature ( Sun and Li, 2010) this is obvious that the hue component value of the shadow regions and background image is almost the same (the hue component of shadow is a bit smaller than the background). If the difference of the hue component in foreground image and background image is smaller than a user defined threshold, this value identifies pixels which are related to the shadows. So more shadow pixels can be categorized. This value is set to two in outdoor images and it is set to one in indoor images Equation (6)

The Boolean Operation
After categorizing different pixels as shadow pixels the final result for this step should be obtained. This is done using a Boolean operator (Logical AND) over four shadow detected images of the four above sub-sections. A pixel categorized as shadow when all the four color features detect that pixel as shadow and finally a primary shadow detected pixel is obtained by assigning 255 to each shadow pixel.
But there are still misclassified pixels. This problem is more highlighted in the images which are taken in multiillumination conditions or in images which the color intensity of the shadow, the object and the background are near to each other. Further, color information cannot separate shadow pixels from the objects completely because of a joint boundary between these two. Edge information helps distinguish these common borders.

Shadow Detection Using the Edge Information
After converting the RGB color image into the HSI color space, the extended gradual C 1 C 2 C 3 and the YC b C r color space, rough shadow-detected pixels are achieved using these color information. But there are still misclassified pixels. To detect missing pixels edge information is used. Figure 4 shows how the method works. This method is an extended version of Kurahashi et al. (2010). In their method, the following 3×3 kernel is used as Sobel operator. This is applied in both x and y directions of the foreground image: By applying Sobel operator to the foreground image, foreground edges are obtained. Then, Sobel operator is applied into the binary image of the foreground image to obtain only edges of the objects and shadow areas connected to the corresponding object. In the next step, by subtracting these two edge images, only interior edges which are mostly related to the objects will be remained. Now this is time to construct the objects.
To construct the object image, first, all of the pixels located between the first pixel and the last pixel of an edge in each row is set to one. Then, the same process goes on for the horizontal pixels, too. Shadow region is resulted by subtracting the binary image extracted from the foreground image and the constructed object image.

Applying Sobel
Operator to the Background Image Next step in the process of detecting shadow pixels by edge information is applying Sobel operator to the background obtaining edges. This is done to remove the background pixels which are detected as object pixels by mistake. Finally, by subtracting the background edges from the detected shadow pixels, the result of this step gets ready.

The Boolean Operation to Synthesize the Final Results
After finding approximate results of shadow pixels using the edge and color information separately, these results should be synthesized to find the final shadow pixels. This process can be done using a Boolean operator (Logical AND). When all of the above steps detect a pixel as a shadow pixel, the pixel is set to 255 in the final image as a shadow pixel.

Noise Reduction
Noise reduction is done in different steps of the proposed methods. After constructing the binary image, there are a number of scattered pixels which the method has detected them as the foreground pixels incorrectly. By applying a simple noise reduction algorithm, the quality of the image is increased. In this research, the morphological open operator is used to do the noise reduction. Finally, to decrease the effect of existent noises in the final image, either morphological open or close operator is applied.

Experiments and Results
Figure 5 shows detected shadow pixels by the edge information method ( Sun and Li, 2010), the color information method ( Panicker and Wilscy, 2010) and the proposed method in different situations. First row in this figure shows an indoor image with good color and edge information. In the second row the same features for outdoor image is investigated. The following two rows are images with good color features and poor edge information in indoor and outdoor environments, respectively. Fifth row shows the results of an indoor image with poor color and strong edges image followed by an outdoor, poor color and strong edges image. The last two rows are about poor color and edge information images for indoor and outdoor environments respectively. Columns (a), (b), (c), (d), (e) and (f) represent the current image, the background image, the ground truth image, the results of shadow detection by Kurahashi et al. (2010), the results of shadow detection by Lin et al. (2010) and the results of shadow detection by the proposed method respectively. Shadow detection rate (η) which is related to the correct detected shadow pixels and shadow discrimination rate (ξ) which is related to the discrimination between shadow areas and objects and Fscore which is a balancing metric are three common metrics which are selected to show the accuracy of our method. These metrics calculate according to Equation (   where, subscribe s refers to a shadow pixel and subscribe f refers to a foreground pixel. TP s is True Positive. It shows true detected shadow pixels. FN s is False Negative. This refers to the shadow pixels which are wrongly detected as non shadow pixels. f TP is the difference between object ground truth pixels and the number of object pixels which are wrongly counted as shadow pixels. The quantitative results are shown in Table 2. As it is cleared we have high percentage of shadow detection rate, shadow discrimination rate and Fscore values in different situations. The result shows that the average shadow detection rate improvement is 8.33 and 5.32% in comparison with the color information method ( Panicker and Wilscy, 2010) and the edge information method ( Sun and Li, 2010) respectively. Moreover, the average improvement of the shadow discrimination rate is 15.25 and 10.24% in comparison with the color information method ( Panicker and Wilscy, 2010) and the edge information method ( Sun and Li, 2010) respectively. The average Fscore improvement is 11.75 and 7.57% in comparison with the color information method ( Panicker and Wilscy, 2010) and the edge information method ( Sun and Li, 2010) respectively. Figure 6 demonstrates the improvement of the proposed method in comparison with Panicker and Wilscy (2010) method and Sun and Li (2010) method. Negative values relate to the decrement of related metric.

CONCLUSION
Despite the drawbacks of color technique and edge technique, combination of these two techniques covers each other weaknesses and it is helpful to detect shadows in different images. In the proposed method, first shadow pixels are detected by the color information using three different color spaces and also by the edge information using Sobel operator; then the results of each step synthesizes by Boolean operator; finally, post processing is done to improve the results. The results show the improvement of the proposed method in comparison to the color-based methods and edge-based methods individually.
This study showed the way of shadow detection in different images. However, making an automatic method is one of our areas of interest. There are a number of directions which could be used in this method to get better detection and discrimination rates in the future such as finding a proper way to combine the results of each step instead of the Boolean operator, introducing a number of learning methods to assign values to the parameters which have a critical role in the performance of the proposed method automatically, presenting a shadow removal system which is based on the shadow detection method and extending the method to work also on the gray-scale images.