Ask Your Question
0

cvApproxPoly alternative for OOP C++ (CV2)

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

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
3

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

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 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

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

Seen: 1,591 times

Last updated: Aug 09 '12