Ask Your Question
1

cvApproxPoly alternative for OOP C++ (CV2)

asked 2012-08-08 13:58:22 -0600

Hi, i tried migrating my OpenCV app to the C++ API because i got too much memory leak and i heard its well managed in C++ API ..

but now i try to found an alternative for the cvApproxPoly function, i tried approxPolyDP() but it has significantly different arguments usage ..

And i can't find cvContourPerimeter too ..

thanks for helping me !

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
4

answered 2012-08-09 01:50:46 -0600

Michael Burdinov gravatar image

approxPolyDP() is not an alternative function to cvApproxPoly(), it is the same function with different API. Much simpler API actually. All you need to provide is input contour, container for output contour, epsilon (same one you used in cvApproxPoly), and flag whether the contour is open or closed. You still can provide your contour as CvSeq but vector of points is much more convenient and safer from memory leaks. Read rest of details here.

Use arcLength to calculate perimeter.

edit flag offensive delete link more

Comments

1

It may not be clear from the post or the docs, but the C++ function accepts contours parameter as std::vector<std::vector<cv::Point>>.

sammy gravatar imagesammy ( 2012-08-09 02:06:54 -0600 )edit

Question Tools

Stats

Asked: 2012-08-08 13:58:22 -0600

Seen: 2,390 times

Last updated: Aug 09 '12