shadow detection using matlab

3
Muhammad Irsyadi Firdaus (P66067055) Iva Nurwauziyah (P66067021) Course: Digital Image Processing 1 Final Project Shadow Detection in Urban Area Images In urban area images, shadows are usually cast by elevated object such as various cultural features (building, bridges, towers, etc.) when they are illuminated by the Sun at the time of exposures. Shadow can provide additional geometric and semantic clues about the shape and position of its casting object and the position of the light source. As a result, cast shadows may cause loss of feature information, false color tone, shape distortion of objects, and failure of conjugate image matching within the shadow area. Therefore, we need to do shadow detection. There are several efficient algorithms to detect shadow. In this final project, we will present how to do shadow detection on the color aerial images. This following are the step to do shadow detection: 1. First transformed the input Red, Green, Blue (RGB) image into the Hue, Saturation, Intensity (HSI) color model. The pixels in a shadow region usually have large hue value, low blue color and small difference between green and blue color values. We consider color aerial images in RGB color format. We benefit from color invariants and grayscale information to extract shadow segments from figure 1. a. Shadow 1 b. Shadow 2 c. Shadow 3 Figure 1. The original image 2. Then, a segmentation process. In the image segmentation process we calculated the ratio between green and blue value of the pixels to elicit shadow. We extract the color information in the aerial image using a specific color index based. There, we used multispectral information from satellite images as the red and near-infrared bands. Here, we follow the same strategy to define a color invariant, but with the blue and green bands of the color aerial image as: = 4 + Where R stands for the red band and G stands for the green band of the color image. This color invariant has a value of unity for red colored objects independent of their intensity values. Similarly, it has a value of minus unity for green colored objects in the image. Therefore, the blue value (of shadow) can be easily segmented using . 3. After that we do threshold. In order to detect shadow segments automatically, we use grayscale histogram of image. First, we smooth this image with a median filter. Since, shadows generally appear in the darker regions of an image, we choose the first local minimum in the histogram as the threshold value. We extract shadow segments by thresholding the grayscale image with this automatically calculated threshold value. Using this method, we obtain the shadow segments as in Fig. 2. We provide the detection results on a blank image to increase visibility of segments.

Upload: muhammad-irsyadi-firdaus

Post on 24-Jan-2018

84 views

Category:

Engineering


7 download

TRANSCRIPT

Page 1: Shadow Detection Using MatLAB

Muhammad Irsyadi Firdaus (P66067055) Iva Nurwauziyah (P66067021) Course: Digital Image Processing

1

Final Project Shadow Detection in Urban Area Images

In urban area images, shadows are usually cast by elevated object such as various cultural features

(building, bridges, towers, etc.) when they are illuminated by the Sun at the time of exposures. Shadow can provide additional geometric and semantic clues about the shape and position of its casting object and the position of the light source. As a result, cast shadows may cause loss of feature information, false color tone, shape distortion of objects, and failure of conjugate image matching within the shadow area. Therefore, we need to do shadow detection.

There are several efficient algorithms to detect shadow. In this final project, we will present how to do shadow detection on the color aerial images. This following are the step to do shadow detection: 1. First transformed the input Red, Green, Blue (RGB) image into the Hue, Saturation, Intensity (HSI)

color model. The pixels in a shadow region usually have large hue value, low blue color and small difference between green and blue color values. We consider color aerial images in RGB color format. We benefit from color invariants and grayscale information to extract shadow segments from figure 1.

a. Shadow 1 b. Shadow 2 c. Shadow 3

Figure 1. The original image 2. Then, a segmentation process. In the image segmentation process we calculated the ratio between green

and blue value of the pixels to elicit shadow. We extract the color information in the aerial image using a specific color index based. There, we used multispectral information from satellite images as the red and near-infrared bands. Here, we follow the same strategy to define a color invariant, but with the blue and green bands of the color aerial image as:

𝜓𝜓𝑟𝑟 = 4𝜋𝜋𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 �

𝐵𝐵 − 𝐺𝐺𝐵𝐵 + 𝐺𝐺

Where R stands for the red band and G stands for the green band of the color image. This color invariant has a value of unity for red colored objects independent of their intensity values. Similarly, it has a value of minus unity for green colored objects in the image. Therefore, the blue value (of shadow) can be easily segmented using 𝜓𝜓𝑟𝑟.

3. After that we do threshold. In order to detect shadow segments automatically, we use grayscale histogram of image. First, we smooth this image with a median filter. Since, shadows generally appear in the darker regions of an image, we choose the first local minimum in the histogram as the threshold value. We extract shadow segments by thresholding the grayscale image with this automatically calculated threshold value. Using this method, we obtain the shadow segments as in Fig. 2. We provide the detection results on a blank image to increase visibility of segments.

Page 2: Shadow Detection Using MatLAB

Muhammad Irsyadi Firdaus (P66067055) Iva Nurwauziyah (P66067021) Course: Digital Image Processing

2

a. Shadow 1 b. Shadow 2 c. Shadow 3

Figure 2. Threshold with radius 0.1 4. Then morphological to remove the noise using Erosion and Opening method. Images segmented by

thresholding often end up leaving some noise in the form of loose pixels. As the image is binary, one form to remove those pixels is to perform morphology operations, such as Opening and Closing. We perform morphological Opening to the shadow mask which was segmented in order to remove noise and properly include boundaries (penumbra) in the final shadow mask. Opening operation is defined as the Erosion of the image A by the structuring element B followed by the dilation of the result by B. We define this operation as,

𝐴𝐴 ⋅ 𝐵𝐵 = (𝐴𝐴⊝ 𝐵𝐵) ⨁ 𝐵𝐵 where Erosion ⊝ ‘‘shrinks” the objects in a binary image according to the structuring element B. Dilation ⨁ is its dual operation, where it ‘‘grows” the objects according to the structuring element B.

a. Shadow 1 b. Shadow 2 c. Shadow 3

Figure 3. Opening Results

a. Shadow 1 b. Shadow 2 c. Shadow 3

Figure 4. Shadow Boundaries

Page 3: Shadow Detection Using MatLAB

Muhammad Irsyadi Firdaus (P66067055) Iva Nurwauziyah (P66067021) Course: Digital Image Processing

3

5. The Overall Layout of The Interface

Figure 4. Graphical User Interfaces (GUI)