openCv4Android之fitLine中各算法总结

本文深入探讨了OpenCV Imgproc类中用于拟合2D和3D点集为直线的方法,详细解释了核心参数及其作用,并对比了不同距离函数的优缺点。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Imgproc类中有将2D点集或3D点集拟合成直线的方法 

public static void fitLine(Mat points,

           Mat line,
           int distType,
           double param,
           double reps,

           double aeps)

这类方法的本质都是(by minimizing sum_i rho(r_i) where r_i is a distance between the i^(th) point, the line and rho(r) is a distance function)就是使点集与线的误差和最小。其中rho(r_i)是距离函数,其类型有如下几种:

distType=CV_DIST_L2

rho(r) = r^2/2(the simplest and the fastest least-squares method

distType=CV_DIST_L1
rho(r) = r

distType=CV_DIST_L12
rho(r) = 2 * (sqrt(1 + frac(r^2)2) - 1)

distType=CV_DIST_FAIR
rho(r) = C^2 * ((r)/(C) - log((1 + (r)/(C)))) where C=1.3998

distType=CV_DIST_WELSCH
rho(r) = (C^2)/2 * (1 - exp((-((r)/(C))^2))) where C=2.9846

distType=CV_DIST_HUBER
rho(r) = r^2/2 if r < C; C * (r-C/2) otherwise where C=1.345

输出的Line有(vx, vy, x0, y0)或(vx, vy, vz, x0, y0, z0),其中都是(vx, vy)或(vx, vy, vz)归一化的向量。


reps和aeps控制原点和西安之间的距离与角度的精度。


该方法的问题是未剔除掉奇异点。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值