Friday, 29 January 2016

openCV App: Vehicle Detection and counting

This is a simple program implemented in opencv to detect and count the number of vehicles passing through a virtual fence. A virtual fence is an imaginary line/region of interest (ROI) which is used in detection and processing of a moving object. A virtual fence can be useful for counting of an object, detection of intrusion, determining direction of a moving object but for this purpose we have limited the function of our virtual fence to detection and counting. However, many a priori assumptions were made for determining the optimality taking into account environmental factors such as location and positioning of the camera, illumination variation, ambient noise etc..
The procedure is as follows
  • An inital frame is kept as a reference (prev_frame) and later the next frame (current_frame) is taken and the forward difference(current_frame - prev_frame ) is calculated.
  • Later this image is thresholded to a value such that the noise is suppressed and the objects and highlighted and median filtering is done to remove any noise which might have come after thresholding.
  • After thresholding, we see that the object is not connected properly so morphological operators are used to join the object.

No comments:

Post a Comment