椭圆拟合程序的源码,用于图像处理。 Descr iption There are two main methods for least squares ellipse fitting: 1) Minimise algebraic distance, i.e. minimise sum(F(x)^2) subject to some constraint, where F(x) = x'Ax + b'x + c This is a linear least squares problem, an
最小二乘
步骤找到最适合N点的线:
步骤1:对于每个(x,y)点,计算x2和xy
第2步:将所有x,y,x2和xy求和,得出Σx,Σy,Σx2和Σxy(Σ表示“求和”)
步骤3:计算斜率m:
m = N Σ(xy) − Σx ΣyN Σ(x2) − (Σx)2 (N is the number of points.)
步骤4:计算拦截b:
b = Σy