我最近开始使用openCV和python。我有一个项目,我正在寻找轮廓使用findContours
。我得到大约6-8等高线,我正在循环得到的包围框,以适应轮廓。
为此,我使用了minAreaRect(contours)
,它给我旋转的矩形,应该符合轮廓。现在,这个命令的输出是一个元组列表。
每个元组看起来都像这个((81.0, 288.0), (22.0, 10.0), -0.0)
,我无法得到关于每个数字的任何描述?
我想可能是((x-坐标,y-坐标),(宽度,高度),旋转).
发布于 2019-09-17 05:15:21
你是对的。通过查看OpenCV (C++)在cv::minAreaRect
上的文档,我们可以看到返回了一个cv::RotatedRect
。全施工 of cv::RotatedRect
是:
cv::RotatedRect::RotatedRect(const cv::Point2f& center, const cv::Size2f& size, float angle)
相应参数的说明如下:
center The rectangle mass center.
size Width and height of the rectangle.
angle The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
显然,center
和size
在Python中被视为元组,所有三个参数也作为元组返回。所以,所有这些都很符合你的假设。
希望这能帮上忙!
发布于 2022-09-13 10:50:33
根据我的观察,函数给出了如下结果:(中心(x,y),(宽度,高度),旋转角度)=cv2.minAreaRect(点)
https://stackoverflow.com/questions/57967420
复制相似问题