How to add the points[4] to the contours by using opencv framework
I'm currently using opencv framework(3.4.1) for object measuring, but I am not able to add points[4] to the contours. Please let me know how to add points[4] to the boxContours in the code below. I can pass boxContours to the drawContours only if I add points to the former.
std::vector<std::vector<cv::Point>> contours;
vector<cv::Vec4i> hierarchy;
cv::findContours( gray, contours, hierarchy, CV_RETR_EXTERNAL,
CV_CHAIN_APPROX_SIMPLE);
for (int i = 0; i< contours.size(); i++)
{
cv::RotatedRect rect = cv::minAreaRect(contours[i]);
cv::Point2f points[4];
rect.points(points);
std::vector<std::vector<cv::Point2f>> boxContours;
cv::drawContours(image, boxContours, i,cvScalar(0,255,0),2);
}
I think you have already posted here and got the answers. What else do you need?
vector<vector<Point>>
(not the Point2f version)Thanks @Balaji i will try it and let you know