I want to draw custom sequence of Points with OpenCV drawContours function.
My code:
std::vector<std::vector<cv::Point> > contours;
std::vector<cv::Point> contour1;
contour1.push_back(cv::Point(100,100));
contour1.push_back(cv::Point(500,500));
contour1.push_back(cv::Point(500,100));
contours.push_back(contour1);
cv::drawContours(testDrawingImage,contours,-1,cv::Scalar(0,0,255),5);
cv::imshow("test",testDrawingImage);
Why in this case triangle is drawn instead of L-shape?
Of course I know that I could do this with line. But maybe someone figured out how it should be passed to drawContours function.
drawContours()does exactly what it says it will, it draws a contour enclosed by the points you give it. A contour is an outline of a closed shape, therefore thedrawContours()function will give you a closed shape from the points you provide.