旋转矩形,不多解释。很好懂
旋转矩形的绘图没有现成的函数,只能画线的方式完成。
Mat image(240, 320, CV_8U, Scalar(0));
RotatedRect rRect = RotatedRect(Point2f(100,100), Size2f(100,50), 30);
Point2f vertices[4];
rRect.points(vertices);
for (int i = 0; i < 4; i++)
line(image, vertices[i], vertices[(i+1)%4], Scalar(255));
Rect bRect = rRect.boundingRect();
rectangle(image, bRect, Scalar(128));
imshow("rectangles", image);
waitKey(0);