International Core Journal of Engineering 2020-26 | Page 205
more feasible to be implemented in a resource-limited
system, just like FPGA.
dilation process
•
T n (x, y) = |P n (x, y) − P n−1 (x, y)|
(8)
In (8), we use two frames P n (x, y) and P n−1 (x, y) to
perform the subtraction so as to ſnd the contour of
moving objects. It should be noted that, for those pixels
regarded as in shadow area in stage 8 will not be used for
the temporal subtraction process. In addition, the result
obtained in this stage can have lots of noise and fragile
contour. Therefore a sequence of image processing
techniques including binarization, morphology, as well
as moving object segmentation will be applied.
•
Stage 10. Binarization and Binary Filter: After the tem-
poral subtraction between two consecutive frames, a pixel
at position (x, y) will be set to be 31 (i.e., a bright spots)
if the T n (x, y) is greater than a predeſned threshold.
Conversely, if T n (x, y) is smaller than or equal the
threshold, the pixel will be set to 0 (i.e., a dark spots).
31 if T n (x, y) > 1
(9)
M n =
0
otherwise.
After the binarization process in (9), a median ſler is
applied (as in (10). With the median ſlter, the salt and
pepper noise can be effectively removed.
31 if P 1 + P 2 + ... + P 9 ≥ ε 2
(10)
P 5 =
0
otherwise.
where the P 1 , P 2 , . . . P 9 in (10) are the value of the nine
pixels in the 3 × 3 area to be ſltered. In the proposed
algorithm, we only have two values, i.e., 0 and 31, after
the binarization process, the summation of (10) will be
in the interval between 0 to 279. Therefore, the threshold
ε 2 can be any value between 0 to 279. In this paper, the
threshold is set to be 93 (i.e., 31∗3). That is the median
P 5 will be set to 31 if P 1 +P 2 +...+P 9 is greater than or
equal the threshold 93, otherwise P 5 will be 0.
•
Stage 11,12. Morphology (Dilation and Erosion): In this
paper we use the temporal subtraction method for moving
object detection. In most of the cases, we only can
get the contour of a moving object with the temporal
subtraction approach. After the binarization and median
ſltering process, the image obtained can still be fractal
and have many broken parts or holes. In the proposed
algorithm, we use the close operation in morphology
to remove the noise and keep the integrity of detected
moving objects as in (11).
A • B = (A ⊕ B) B
•
(11)
Stage 13. Moving object segmentation
The detected moving objects will be shown on a display
monitor via the VGA port on the DE2-70 FPGA module.
The scanning sequence of a VGA port is from left
to right, top to bottom, i.e., raster scan. Besides, the
resolution of a VGA port is 640 × 480 pixels. In the
proposed system, the origin (0,0) is deſned at the top-left
corner, while the coordinate (639, 479) is at the bottom-
right corner.
To begin the segmentation of moving objects, we use the
image data obtained in stage 12 as the input, and then
perform raster scan on the input image. The process can
be divided into two phases; phase 1: column partition,
and phase 2: row partition.
– Column partition: When doing column scanning, we
use bitwise “or” operation for all 640 horizontal
pixels with corresponding consecutive rows (i.e., hor-
izontal pixels). With this scanning method, we will
get 640 temporary data (640 bits), which represent if
the corresponding column contains a moving object
or not. After that we apply “xor” operation for
these 640 bits (i.e., registers) from left to right in
a sequential manner to ſnd the vertical boundary of
a moving object.
– Row partition: After the column partition process,
we rotate 90 degree for the image and perform the
same operation as that in column partition again to
get the horizontal boundary of moving objects. By
this way we get boundaries for all horizontal and
vertical coordinates. When we obtain data of the ſrst
horizontal border, we will proceed for the second
scanning. This scanning is to ſnd division according
to the horizontal coordinate obtained by the ſrst
scanning, i.e., to scan respectively for all objects
in the horizontal coordinate. The ſrst coordinate we
obtained is the ſrst vertical coordinate, and the last
coordinate is the second vertical coordinate. We scan
for horizontal coordinates of all objects to obtain all
corresponding vertical boundary coordinates, and a
real time moving objects segmentation process can
be obtained.
Stage 14. VGA display: in this stage, the detection result
(individual frames) will be shown on the display via the
VGA port. It should be noted that each of the three
components of RGB requires 8 bits for the VGA output
port. Therefore, the quantized RGB components will be
expanded to ſt the requirement of VGA controller.
III. E XPERIMENTAL R ESULTS
where the operator • in (11) means ”Closing operator”,
and the ⊕ and indicates “dilation” and “erosion”,
respectively. That is the erosion will be applied after the
In this section, the hardware resource usage will be ana-
lyzed. Moreover, the moving object detection results under
different interference environment will be given.
183