About counting cars using Matlab

1 view (last 30 days)
I askedthis question earlier but gave the wrong link. I have updated the link.
I am a new to matlab. I am doing a project that will require me to count the number of cars entering a street and exiting on the other side. Using the information, I will require to compute the number of cars on that particular street as in:
Density = Entering cars - Exiting cars.
Therefore I need to have two Regions of Interest in the video in form of a trigger line(line that counts when triggered by a car) as shown in this * video * . The example is done in matlab, am sure its possible. Does anyone know how I can go about this, I do not even know how I could insert such a line in a video. Thanks in advance

Accepted Answer

Dima Lisin
Dima Lisin on 16 Jul 2014
Here is a more complicated example of tracking multiple objects, which could be cars.
  3 Comments
Dima Lisin
Dima Lisin on 16 Jul 2014
When you use vision.ForegroundDetector, you get back a binary image, in which the white blobs correspond to moving objects. You can use the vision.BlobAnalysis object to extract individual blobs, and compute their centroids and/or bounding boxes. Then all you have to do is determine whether the centroid or the entire box is above or below a horizontal line, i. e. whether its y-coordinate is greater than or less than a certain value.
If you want to see the line in the video, you can use the insertShape() function to draw it into the frame.
charushila raskar
charushila raskar on 9 Nov 2017
I appreciate your answer .I want to ask in the same lines,how to get the total count of cars in whole video.I could find it in individual frame,but how to store and add.Thanks a lot.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!