Opencv How to detect 4 corners of a rectangle after applied cv::findContours and cv::drawContour

StackOverflow https://stackoverflow.com/questions/20957185

質問

My problems is I want to find 4 corners of rectangles after using cvfindcontours ? Here is my result:

image:
enter image description here

How can I find 4 corners of each rectangle? I think the building function Cv find and draw contours have their information of the corners, so how can I read it?

正しい解決策はありません

他のヒント

(modified from here)

// Find the rotated rectangles for each contour
vector<cv::RotatedRect> cv::minRect( contours.size() );

for( size_t = 0; i < contours.size(); i++ )
{
    minRect[i] = minAreaRect( cv::Mat(contours[i]) );
}

If you want the actual points on the contour, you can later find for each contour the points that is closest to each of the corners of the RotatedRect

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top