搜索
您的当前位置:首页椭圆拟合fitEllipse()函数

椭圆拟合fitEllipse()函数

来源:世旅网

先对图像二值化检测边缘,利用findContours()提取轮廓后,再对轮廓进行椭圆拟合。
二维点集的椭圆拟合,用椭圆将二维点包含起来。
fitEllipse()函数调用形式:
C++: RotatedRect fitEllipse(InputArray points)

函数的输入是:二维点集,要求拟合的点至少为6个点,存储在std::vector<> or Mat
输出是:RotatedRect的参数:包含中心点坐标,以及矩形的长度和宽度还有矩形的偏转角度。输出是RotatedRect 类型的矩形,是拟合出椭圆的最小外接矩形。
椭圆拟合API:

RotatedRect fitEllipse(InputArray points)

画出椭圆:
Ellipse()函数
函数作用:根据输入的椭圆参数画出椭圆
函数形式:
C++: void ellipse ( Mat& img , const RotatedRect& box , const Scalar& color , int thickness =1, int lineType =8 )
API:

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)

参考博文:

https:///i_chaoren/article/details/78358991

因篇幅问题不能全部显示,请点此查看更多更全内容

Top