fitline拟合函数:
CV_EXPORTS_W void fitLine(
InputArray points, //待输入点集
OutputArray line, //输出点集(一个是方向向量,另一个是拟合直线上的点)
int distType,//拟合方法
double param, //以下参数使用默认值
double reps,
double aeps );
拟合方法总结:
CV_DIST_USER =-1, /* User defined distance */
CV_DIST_L1 =1, /* distance = |x1-x2| + |y1-y2| */
CV_DIST_L2 =2, /* the simple euclidean distance */
CV_DIST_C =3, /* distance = max(|x1-x2|,|y1-y2|) */
CV_DIST_L12 =4, /* L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */
CV_DIST_FAIR =5, /* distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */
CV_DIST_WELSCH =6, /* distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */
CV_DIST_HUBER =7 /* distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
在这里不讨论最小二乘法原理和直线方面的知识。
通过寻找图片