OpenCV RotatedRect angle is wrong
2014-05-29 14:36
405 查看
Improving on the answer of @Adam Goodwin i want to add my little code that changes the behaviour a little bit:
I wanted to have the angle between the longer side and vertical (to me it is the most natural way to think about rotated rectangles):
If you need the same, just use this code:
To see it in action just insert it in Adam Goodwins code:
I wanted to have the angle between the longer side and vertical (to me it is the most natural way to think about rotated rectangles):
If you need the same, just use this code:
void printAngle(RotatedRect calculatedRect){ if(calculatedRect.size.width < calculatedRect.size.height){ printf("Angle along longer side: %7.2f\n", calculatedRect.angle+180); }else{ printf("Angle along longer side: %7.2f\n", calculatedRect.angle+90); } }
To see it in action just insert it in Adam Goodwins code:
printf("Angle given by minAreaRect: %7.2f\n", calculatedRect.angle); printAngle(calculatedRect); printf("---\n");
原文
相关文章推荐
- opencv 3.0 旋转矩形 RotatedRect
- 【转】OpenCV对图片中的RotatedRect进行填充
- OpenCV对图片中的RotatedRect进行填充
- 基础——RotatedRect中返回的角度angle
- 【OpenCV】通过鼠标在图像中绘制RotatedRect旋转矩形
- OpenCV中RotatedRect 以及 Rect介绍
- 【OPENCV】点与RotatedRect矩形的包含关系
- OpenCV笔记(RotatedRect)
- OpenCV中两个旋转矩形RotatedRect的交集
- 获取OpenCV中RotatedRect的绝对角度
- 关于opencv中RotatedRect的角度疑问
- opencv2.32学习笔记 有向边框RotatedRect的绘制 以及外边框计算
- opencv学习笔记:RotatedRect和CvBox2D的角度疑云
- 获取OpenCV中RotatedRect的绝对角度
- 基础——RotatedRect中返回的角度angle
- opencv:RotatedRect和CvBox2D的角度疑云
- OpenCV学习六:findContours、drawContours、仿射变换、RotatedRect区域矫正及获取
- 关于OPENCV The node is neither a map nor an empty collection in function cvGetFileNodeByName
- What is OpenCV
- error C2361: initialization of 'rect' is skipped by 'default' label