【源码】对指定数据集进行椭圆形拟合的函数fit_ellipse

在这里插入图片描述
该函数使用最小二乘准则对给定的一组点(x,y)进行椭圆的最佳拟合。

This function uses the Least-Squares criterion for estimation of the best fit to an ellipse from a given set of points (x,y).

LS估计是对椭圆(可能倾斜)的二次曲线进行的。

The LS estimation is done for the conic representation of an ellipse (with a possible tilt).

其表达式 = ax2+b*x*y+c*y2+dx+ey+f=0。(当xy项存在(即b~=0)时,椭圆的倾斜/方向发生变化)

Conic Ellipse representation = ax2+b*x*y+c*y2+dx+e*y+f=0

(Tilt/orientation for the ellipse occurs when the term x*y exists (i.e. b ~= 0))

随后,在估计过程后,从椭圆中去除倾斜(使用旋转矩阵),然后从表达式中提取描述椭圆的其余参数。

Later, after the estimation, the tilt is removed from the ellipse (using a rotation matrix) and then, the rest of the parameters which describes an ellipse are extracted from the conic representation.

出于调试的目的,可以在给定轴句柄的顶部绘制出估计结果。

For debug purposes, the estimation can be drawn on top of a given axis handle.

注意:

Note:

1)该函数不适用于三维轴系统。(仅适用于2D)

  1. This function does not work on a three-dimensional axis system. (only 2D)

2)为了估计椭圆的5个参数,至少需要5个点。

  1. At least 5 points are needed in order to estimate the 5 parameters of the ellipse.

3)如果数据表现为双曲线或抛物线,该函数返回空字段和状态指示。

  1. If the data is a hyperbola or parabula, the function return empty fields and a status indication

完整源码下载地址:

http://page2.dfpan.com/fs/4ldcfj32f2011219163/

更多精彩文章请关注微信号:在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42825609/article/details/88649304