In the previous segment, you got the intuition of tracking as, for a blob in the present time frame, you try to find a match the blobs in previous time through extrapolation and finding the minimum distance. If it is less than a threshold, we say that we found a match and do not count it as a separate vehicle. Let’s see its pseudo code.
Note: There is a correction. ‘Invalid’ blobs which could not be tracked for 5 consecutive frames. Suppose a blob is tracked for 3 frames and could not be tracked from 4th to 8th frame, in this case, it will be called invalid. The reason is, if one vehicle instead of 2 during contour mapping. And it may appear as separate vehicles in another timestep, maybe due to variation in speed of those 2 vehicles. So, we want to continue tracking it for at least 5 consecutive frames before we consider it as invalid.
Suppose there are 10 ‘valid’ blobs in the existingBlobs() and ’11’ blobs in the currentFrameBlobs(). Then you would possibly get match only for 10 blobs and 1 extra blob is a new blob that has entered the frame for the first time. You add this blob to existingBlobs(), so that it can be tracked for the next timestep. In the next timestep, you will have 11 predicted positions and 11 current positions (assuming no new vehicle has entered the frame), and you will get a match for all the 11 blobs.
For the blobs for which you got a match, you update the parameters of the blob in the existingBlobs() such as area, centre positions, etc. so that you can find its predicted position for the next time step using the updated positions and properties. Let’s summarise this in the next video.
In the next segment, you will go through the actual code and look at how to predict the next position.
Report an error