8
Internet of Things (IoT)
brightness levels of the three primary colors (red, green, and blue) for transmitted
light, or equal amounts of the three primary pigments (cyan, magenta, and yellow) for
reflected light.
1.4.2 Adaptive Background Subtraction
After preprocessing, the main task of background subtraction is to find d which is
defined as d(p) = |Fg(p) − Bg(p)|. Here, Fg refers to foreground image, and Bg refers
to back ground image. “p” refers to the position of various pixels on the image. Thus,
d(p) refers to the distance between foreground and background image pixels. This difference must maintain the value less than the threshold value which is determined by
the user. We store the d(p) value in a visual pattern which is done by creating a matrix
of size similar to foreground image which we call as “abs image.” If the d(p) is below
a definite threshold value, then the “abs” image is padded with lowest intensity value
and if d(p) goes beyond the definite threshold value, then the “abs” image is padded
with the highest intensity value. The abs image gives the subtraction of background
and foreground image. Now we need to change the background image according to
the change in the environmental or dynamic road condition such as a vehicle. It checks
the background frame and verifies whether there is any change in the background
image with respect to the foreground image. If Bg(p) > Fg(p) for the location p, then the
background intensity Bg(p) is added with some arbitrary value, that is, “Bg(p) + value”
and if Bg(p) < Fg(p), then Bg(p) is subtracted with the same arbitrary value, that is,
“Bg(p) – value,” and if Bg(p) = Fg(p), then no change is done on the background image.
Our next intention is to increase the global contrast of foreground and background
gray-scale images, especially when the usable data of the image is represented by the
nearest contrast values. Through this adjustment, the intensities can be better distributed
on the histogram. This allows for areas of lower local contrast to gain a higher contrast.
Histogram equalization accomplishes this by effectively spreading out the most frequent
intensity values.
1.4.3 Object Detection
The processed image (“abs” image) now contains high-intensity levels (which corresponds to the foreground and background intensity difference) indicating the presence
of an object (i.e., vehicle). Then, we apply morphological operations on this processed
image. In a morphological operation, the value of each pixel in the output image is
based on a comparison of the corresponding pixel in the input image with its neighbors.
The  shape and size of the structural element is used to remove imperfections added
during segmentation.
Figure 1.7 shows the auto-cropping algorithm used for obtaining the ROI from the
chosen input foreground image. The algorithm is performed on the black and white
images obtained from the background subtraction algorithm, and from this image
one can identify the pixel location values for cropping the vehicle from the given foreground image. Initially, the size of image is stored in two variables, in which one is
used to define the row size (say, row) and the other is used to define the column size
(say, col). Now the variables m and n are set such that they store the starting location,
namely top left corner of the image [say, p(1,1)] and bottom right corner of the image
[say, p(row, col)]. We look for the first transition from low to high-intensity value of
pixels from all sides (top, bottom, left, right) of the image. By scanning the binary image
Précédent

- 33/358

Suivant