Is there any available material that specifies how I can find the speed of detected contours/their centroids? I am using the lk_tracker.py example included in the opencv samples. I don't really have a clear idea of the internal workings of the algorithm. How do I track just the centroids of the contours of interest I have already identified?
Asked
Active
Viewed 372 times
0
-
I guess you're processing video? If you're not tracking between frames, do you only have one object of interest? Please give more detail. – Roger Rowland Jun 02 '14 at 06:18
-
Yes I am processing a video of traffic. I have counted the number of vehicles, by counting the number of times the centroid of the detected blob crossed a given line. Hence, am not tracking. – GradStudent Jun 02 '14 at 06:29
-
To estimate speed, you would need two frames containing the same blob and some calibration to relate pixel offset to actual speed - so a fixed camera and view restricted to a single lane - does that describe your set-up? Have you considered optical flow? – Roger Rowland Jun 02 '14 at 06:32
-
The camera is fixed, but there are about 6 lanes with traffic moving in both directions. – GradStudent Jun 02 '14 at 06:36
-
Ok, then without tracking you can't tell which blob is which, so no hope of getting speed. Looking at optical flow may be your only hope but traffic moving in both directions will confuse things unless you can partition the images. – Roger Rowland Jun 02 '14 at 06:45
-
I am not looking to get an exact measurement of the speed, but say I measure the displacement of the blob in the next frame, and calculate the speed using the frame rate, to get an average speed of the vehicles (assumption, since it's a highway). Do you think that'd work? – GradStudent Jun 02 '14 at 07:36
-
That would work if you are tracking blobs - you have to locate the same blob in two or more frames. Without tracking, you don't know if a blob in the second frame is the same car as a blob in the first frame. – Roger Rowland Jun 02 '14 at 07:39
-
Ok. Could you please suggest any good documents on tracking? I have tried a few and have found it very difficult/it didn't work, hence the aversion. – GradStudent Jun 02 '14 at 07:45