Then, several computer
vision techniques, including thresholding, hole filling,
morphology operation, were applied to remove noise and to
enhance foreground objects. Next, we extracted the contour of
detected foreground objects and calculated their centroids.
Finally, the vehicles were detected and counted when their
centroid passed into the virtual detection zone.