how to count all vehicles in matlab
2 views (last 30 days)
Show older comments
Jaswanth kumar Jalagam
on 13 Mar 2018
Commented: Image Analyst
on 3 May 2020
i already have vehicle count in each frame but i need to count all the vehicles in the video ,please this is for final project any help is greatfully appreciated
1 Comment
Ameni chetouane
on 9 Jul 2019
i have the same problem,could you please tell me how did you fix the error?
Accepted Answer
Image Analyst
on 13 Mar 2018
For each vehicle, you need to use tracking to determine whether the blob is new to that frame, or existed in a prior frame. If it's new, increment your total car count.
2 Comments
Mrityunjay Jha
on 3 May 2020
@Image Analyst I understood your point but I am finding difficulty in implementing this. Can you please elaborate on this?
Image Analyst
on 3 May 2020
I'm no expert on tracking and I can't write such a complicated app for you (it's far from trivial) , but I imagine you'd have an N-by-3 table where each particle is one row.
- The first column is it's current x location (or array of all x locations since you first found that particle/car/blob).
- The second column is it's current y location (or array of all y locations since you first found that particle).
- The third column is whether that particle is currently in the frame.
The row in the table is essentially the ID number of the particle. So for every particle in frame n you need to compute the distance, using sqrt(), of the particle to every other particle in the prior (n-1) frame, and find the closest distance. If that distance is less than what you'd expect the particle to move, then you can assume that is the same particle and update it's location (x,y). If no other particle is close enough, then you might assume that that is a new particle that has just entered the field of view and create a new row in the table for it. If there is a particle in frame (n-1) where there is no other particle close to it in the current frame, then you can assume it's left the field of view and update the third column to "false". It gets much, much more complicated than that. You might want to just see if you can buy tracking software to save you a lot of time and get something more accurate than a home-built solution.
More Answers (0)
See Also
Categories
Find more on Automated Driving Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!