如何在OpenCV中获取旋转矩形的顶点?

时间:2014-01-20 15:09:05

标签: c++ opencv rotation rectangles image-rotation

我在OpenCV中使用warpAffine来旋转矩形。现在我想获得这个旋转矩形的四个顶点(四个点的x和y位置),而不是将其旋转回来。经过几个小时的搜索,我得不到任何结果。有人可以帮我吗?谢谢。

1 个答案:

答案 0 :(得分:6)

像这样:

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

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

documentation也有一个例子。

相关问题