Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

drawContours() actually only draws the points, not line segments.

if you want that, try:

std::vector<cv::Point> contour_line;
cv::approxPolyDP(cv::Mat(contours[i]), contour_line, 5, true); // last arg is "closed line" 
int nc = contour_line.size();
const cv::Point * pc = &(contour_line[0]);
cv::polylines( img, &pc, &nc, 1, 0, cv::Scalar(255) );