【15】OpenCV C++实战篇——fitEllipse椭圆拟合、 Ellipse()画椭圆
文章目录
- 1.2 fitEllipse椭圆拟合
- 1.3 Ellipse()画椭圆
1.2 fitEllipse椭圆拟合
RotatedRect fitEllipse( InputArray points );
简介:给出若干个点之后(根据规定 至少六个点),filE函数把点集 拟合为 旋转矩形 并返回
。
返回RotatedRect的参数:center ,size.width size.height , angle
。(包含中心坐标
,矩形的长
、宽
、偏转角度
)
输出RotatedRect 类型的矩形,是拟合出椭圆的最小外接矩形。
返回的RotedRect矩形的参数:
center 即返回矩形的几何中心 ,易于理解。 同时也是最小拟合椭圆你的中心。
width默认为椭圆的短轴返回矩形的短边 ,height默认为椭圆的长轴 ,返回矩形的长边
angle:重点 :返回矩形的角度大小【注:不是弧度】在【0° − 180°】之间。
OpenCV—椭圆拟合fitEllipse
椭圆拟合fitEllipse()函数
opencv–轮廓拟合函数 boundingRect(),minAreaRect(),minEnclosingCircle(),fitEllipse(),fitLine()
fitEllipse函数
Opencv fitEllipse函数详解
1.3 Ellipse()画椭圆
画出椭圆:Ellipse()函数
函数作用:根据输入的椭圆参数画出椭圆
函数形式:
void ellipse(Mat& img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
void ellipse(Mat& img, const RotatedRect& box, const Scalar& color, int thickness=1, int lineType=8)
OpenCV学习笔记(5)_ ellipse绘制函数浅析