Ask Your Question
0

Shapes processing and tracking in C++

asked 2017-01-03 09:35:28 -0600

simozz gravatar image

updated 2017-01-03 14:52:06 -0600

Until now I can draw shapes from a binary image maskFrame into lastFrame as follows:

cv::Mat lastFrame, maskFrame;
std::vector <std::vector <cv::Point>> contours;
// frame processing ... 
findContours(maskFrame, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
drawContours(lastFrame, contours, -1, cv::Scalar(0), 2);

which should be the standard way..

Now, I would need to track these shapes for at least two frames. If I have a shape in frame(n), I would like to know if this shape is also present in frame(n - 1) by some possible information I could get, as area of the shape & position inside the frame.

Is it possible to achieve this whit some other class ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-01-03 19:01:22 -0600

Tetragramm gravatar image

Moments gets the area and position.

HuMoments is a description of the shape that can be matched.

MatchShapes is a method that does the matching using the HuMoments.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-03 09:35:28 -0600

Seen: 280 times

Last updated: Jan 03 '17