Keywords

1 Introduction

When the illumination or the light is blocked by an object a natural phenomenon called shadow is occurred. In computer vision and computer graphics applications, shadow detection and manipulation have an important role to study the object shape [1, 2], size, movement [3], number of light sources and illumination condition [4]. But when shadows are merged with the background image it causes degradation of image quality. Shadow free images can help to improve the performance of the task such as object recognition, object tracking and information enhancement.

According to earlier work on shadow detection, the algorithm mainly depends on spectral, spatial and temporal feature of image. Intensity, chromacity, physical, geometrical and textural features of pixel play important role to find out the shadow in image. However, all those feature based techniques [5] have strict assumptions as they are not compatible for different environment as well as some features are robust and take longer time to implement. A successive thresholding technique (STS) [6] is applied to detect shadow more accurately. Moreover shadow can be detected by dividing the cast shadow region into sub region- umbra, shallow umbra and penumbra shadow region [7]. Multiple convolution neural networks are used to understand the feature of shadow pixels and Bayesian formulation is modeled to extract the shadow region [8]. For high spatial resolution detection of shadow is very critical and difficult to find the contour of the shadow region in degraded image. To get high quality shadow free image the first problem is to detect the area boundary of the shadow region and for the image with complex shadow it is really a difficult and challenging task.

In this paper, we present a comparatively simpler shadow contour detection approach which is based on the color space and the gray level co-occurrence matrix (GLCM) [9, 10] feature of the individual color channel. For this purpose we choose at first the HSV color space since HSV color space contains better information than RGB color space and it is not a device dependent color space representing a closer approximation of human perception to color. Generally hue component are almost same in shadow and non-shadow region in HSV whereas saturation and value component have different characteristics between the two regions.

2 Presented Method

2.1 Color Space Conversion

The purpose of color space is to specify each color by a single point of a coordinate and a subspace within a system. Most commonly used color model or color space is RGB for color monitors and video cameras. As human being is strongly perceptive to the red, green, blue primaries this color space is suitable for hardware implementations. But for describing a color of an object we rather use the terms hue, saturation and its intensity values where hue is a color attribute which describes a pure color like pure red or blue. Saturation is defined as the colorfulness of an area with respect to its brightness. The intensity values describe the color sensation and it can be easily measured by the gray level of the image pixel [11]. So this model carries better information than RGB and frequently used for image processing algorithms like image segmentation, image smoothing and sharpening.

In HSV model hue can be described in terms of an angle in the circular coordinate. Although a circle contains 360 degrees of rotation, the hue value is normalized to a range from 0 to 255, with 0 being red. Saturation value ranges from 0 to 255. The lower the saturation value, the more gray is present in the color, causing it to appear faded. Value represents the brightness of the color. It ranges from 0 to 255, with 0 being completely dark and 255 being fully bright. The hue and saturation level do not make a difference when value is at max or min intensity level. RGB to HSV space conversion can be done using standard equations.

The example of an image in RGB and HSV including the individual channel information is presented in Fig. 1. The interesting observation in Fig. 1 is that the shadow information and background information is not almost same in all channels like RGB channels. Particularly in the S and V channel the shadow and non-shadow difference is well visible. But it is not always that a particular channel or combination of channels will be good for contour extraction for all the cases. This can be addressed by GLCM feature based channel(s) selection mechanism as described in following section.

Fig. 1.
figure 1

Example of original image and its different channels. The top row: original RGB image; middle row from left to right R, G and B channel; bottom row from left to right H, S and V channel.

2.2 Channel Selection for Contour Extraction

In HSV color space hue component is almost same for shadow and non-shadow region but the saturation and value component shows the different characteristic for this two regions. GLCM may be a possible choice for channel selection towards shadow contour detection.

GLCM is a method of extracting the second order statistical texture feature. From the GLCM matrices [9] many features can be extracted [10]. Among those features inertia and inverse difference moment (IDM) of the image pixels in each channel have been used in this work. Inertia is mainly used as a measure of intensity contrast between a pixel and its neighbor pixel over the entire image. Inertia can be expressed as Eq. (1) where \( i,\,j \) are row and column index, respectively, \( G \) is the dimension of GLCM matrices and \( P\left( {i,j} \right) \) denotes the probability matrix calculated from the co-occurrence matrices.

$$ Inertia = \sum\limits_{i = 0}^{G - 1} {\sum\limits_{j = 0}^{G - 1} {\left\{ {i - j} \right\}^{2} \times P\left( {i,j} \right)} } $$
(1)

Inverse difference moment (IDM) is also known as homogeneity and can be expressed as Eq. (2). It measures image homogeneity as it assumes larger values for smaller gray tone differences in pair elements. It is more sensitive to the presence of near diagonal elements in the GLCM. It has maximum value when all elements in the image are same. GLCM contrast and homogeneity are strongly, but inversely, correlated in terms of equivalent distribution in the pixel pairs population. It means homogeneity decreases if contrast increases while energy is kept constant.

$$ IDM = \sum\limits_{i = 0}^{G - 1} {\sum\limits_{j = 0}^{G - 1} {\frac{1}{{1 + \left\{ {i - j} \right\}^{2} }} \times P\left( {i,j} \right)} } $$
(2)

Further from GLCM features the standard deviation in each channel were also calculated. The feature set of each channel was constructed using inertia, IDM and standard deviation.

From the statistical data analysis of the feature sets it was observed that a channel with lower inertia and IDM values with a higher standard deviation is more suitable for shadow contour detection. But some of images do not follow this criterion particularly for complex images where the background and shadow are mixed in a higher degree that means the contrast between the background and shadow is comparatively low. For those images singular value decomposition (SVD) was calculated. The channel having lower value of SVD is considered suitable for shadow detection. It was also found that for complex images a single channel is not sufficient for shadow contour detection, therefore a logical operation between two channels with lower most SVD values was performed. The final contour was extracted by adaptive thresholding of Otsu’s method [12] followed by suitable morphological operations. In this case erosion and dilation morphological operation with standard structuring elements was performed.

3 Results and Discussions

The results found with the database [13] are presented here. The databases also contain shadows under a variety of illumination conditions such as sunny, cloudy and dark environments. Most of the images shadow contour is detected in value channel but in some image shadow can also be detected in saturation channel which we named as complex image. The contour extractions for simple and complex images are shown in Figs. 2 and 3, respectively.

Fig. 2.
figure 2

Example of extracted shadow contour with single color channel (V channel).

Fig. 3.
figure 3

Example of extracted shadow contour with two channel logical operation (S and V channel).

Figures 2 and 3 both show that in all the presented test cases the shadow contour is well detected. Figure 2 comprises two test images that are comparatively simple since the background and the shadow is not well mixed. These cases can be handled by the V channel alone which is showing the lower inertia and IDM values and higher standard deviation values as shown in Table 1. But, in case of images in Fig. 3 which are comparatively complex cases two channels information are used based on the SVD values as shown in Table 1 right side.

Table 1. Feature values for test image in Figs. 2 and 3

4 Conclusion

A simple approach of shadow contour detection based on the HSV color space and the GLCM texture feature of the image pixels is presented in this paper. The method took both simple and complex test cases under consideration. The simple images can be processed by single color channel information while for the complex images two channels information were used for logical operation prior the thresholding and morphological operations to obtain the shadow contour. The results show the possible potential of the technique. The process is less time consuming as well. A major limitation of the process may be appearance of some unwanted bubble which may be outside the contour of interest or within. This can be handled using appropriate post-processing operations. The study can be further extended to the different perception based color spaces, application of adaptive structuring element for morphological operations, channel interaction of different color spaces, etc. This study is focused to the contour detection only while the reconstruction of the image without shadow is probably the most important follow up work in future.