문제

I used warpAffine in OpenCV to rotate a rectangle. Now I want to get the four vertices (the x and y locations of four points) of this rotated rectangle without rotating it back. After hours of search, I came up with no result. Could someone help me on this? Thank you.

도움이 되었습니까?

해결책

Like this:

cv::RotatedRect RotRect;
// Fill in RotRect somehow...

//Get four corners
cv::Point2f pts[4];
RotRect.points(pts);

The documentation also has an example.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top