Ask Your Question

draw a plot between two center points in real-time

asked 2013-12-15 17:19:55 -0500

mahsa gravatar image

updated 2013-12-20 12:33:41 -0500

Moster gravatar image

If I want to draw a line between (center.x , center.y)in the current frame and (center.x , center.y) in the previous frame..should I every time that the code runs keep it in a vector and then take them two by two and use cvPoint() and cvLine() ?

Is this the correct way to do that by using opencv?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-12-20 09:05:32 -0500

Flart gravatar image

updated 2013-12-20 09:07:39 -0500

You can move center from previos frame to current frame, and then draw line.

cv::Point preCenter = cv::Point(0, 0); 

    cv::Point center = cv::Point (preCenter.x+5, preCenter.y+5);

    cv::line(img, preCenter, center, cv::Scalar(255,0,0));

    preCenter = Point(center);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-12-15 17:19:55 -0500

Seen: 401 times

Last updated: Dec 20 '13