I need to track moving shapes in opencv.
Until now I am able to draw the countours around the moving shapes:
cv::Mat lastFrame, maskFrame;
std::vector <std::vector <cv::Point>> contours;
// background substraction and frame processing ...
findContours(maskFrame, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
drawContours(lastFrame, contours, -1, cv::Scalar(0), 2);
but I don't know how to track them.
If I have a shape in frame(n), I would like to know if this shape is also present in frame(n - 1) maybe knowing the area & the position of each shape in both frames.
Do you have some suggestion on how to do it ? Maybe using some class that I obviously don't know ?