opencv: 线性拟合
opencv提供了fitline函数用于直线拟合,原型为:
C++: void fitLine(InputArray points, OutputArray line, int distType, double param, double reps, double aeps) Python: cv2.fitLine(points, distType, param, reps, aeps) → line C: void cvFitLine(const CvArr* points, int distType, double param, double reps, double aeps, float* line) Python: cv.FitLine(points, distType, param, reps, aeps) → line Parameters:
points – Input vector of 2D or 3D points, stored in std::vector<> or Mat.
line – Output line parameters. In case of 2D fitting, it should be a vector of 4 elements (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and (x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line and (x0, y0, z0) is a point on the line.
distType – Distance used by the M-estimator (see the discussion below).
param – Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.
reps – Sufficient accuracy for the radius (distance between the coordinate origin and the line).
aeps – Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.
支持2D,3D的点集拟合,点集使用std::vector<>来存储,如果为3Dpoint,那么line使用Vec6f, 2D points,使用Vec4f;
拟合方式提供了下面几种方法:
distType=CV_DIST_L2 最小二乘法

distType=CV_DIST_L1

distType=CV_DIST_L12

distType=CV_DIST_FAIR

distType=CV_DIST_WELSCH

distType=CV_DIST_HUBER

注: 该博文为扩展型;
opencv: 线性拟合的更多相关文章
- 用python的numpy作线性拟合、多项式拟合、对数拟合
转自:http://blog.itpub.net/12199764/viewspace-1743145/ 项目中有涉及趋势预测的工作,整理一下这3种拟合方法:1.线性拟合-使用mathimport m ...
- 深度学习原理与框架-Tensorflow基本操作-实现线性拟合
代码:使用tensorflow进行数据点的线性拟合操作 第一步:使用np.random.normal生成正态分布的数据 第二步:将数据分为X_data 和 y_data 第三步:对参数W和b, 使用t ...
- 跟我学算法-tensorflow 实现线性拟合
TensorFlow™ 是一个开放源代码软件库,用于进行高性能数值计算.借助其灵活的架构,用户可以轻松地将计算工作部署到多种平台(CPU.GPU.TPU)和设备(桌面设备.服务器集群.移动设备.边缘设 ...
- 机器学习-TensorFlow建模过程 Linear Regression线性拟合应用
TensorFlow是咱们机器学习领域非常常用的一个组件,它在数据处理,模型建立,模型验证等等关于机器学习方面的领域都有很好的表现,前面的一节我已经简单介绍了一下TensorFlow里面基础的数据结构 ...
- MeteoInfoLab脚本示例:线性拟合
MeteoInfoLab提供一个线性拟合函数linregress,参数是参与拟合的两个数据序列,返回拟合的斜率.截距和相关系数.有了上述拟合参数可以用polyval函数生成拟合数据(直线).然后可以将 ...
- [Python] 波士顿房价的7种模型(线性拟合、二次多项式、Ridge、Lasso、SVM、决策树、随机森林)的训练效果对比
目录 1. 载入数据 列解释Columns: 2. 数据分析 2.1 预处理 2.2 可视化 3. 训练模型 3.1 线性拟合 3.2 多项式回归(二次) 3.3 脊回归(Ridge Regressi ...
- Java 使用 Apache commons-math3 线性拟合、非线性拟合实例(带效果图)
Java 使用 CommonsMath3 的线性和非线性拟合实例,带效果图 例子查看 GitHub Gitee 运行src/main/java/org/wfw/chart/Main.java 即可查看 ...
- OpenCV 线性混合(4)
带滚动条的线性混合示例: #include "stdafx.h" #include<iostream> #include<thread> #incl ...
- OpenCV 最小二乘拟合方法求取直线倾角
工业相机拍摄的图像中,由于摄像质量的限制,图像中的直线经过处理后,会表现出比较严重的锯齿.在这种情况下求取直线的倾角(其实就是直线的斜率),如果是直接选取直线的开始点和结束点来计算,或是用opencv ...
随机推荐
- Linux下4个查找命令which、whereis、locate、find的总结
(1)which [-a] cmdname1 cmdname2 ...... 作用:locate a command,从环境变量PATH中,定位/返回与指定名字相匹配的可执行文件所在的路径 ...
- cuda编程-卷积优化
CUDA Convolution https://www.evl.uic.edu/sjames/cs525/final.html Improve Image Processing Using GPU ...
- codeforces525B
Pasha and String CodeForces - 525B Pasha got a very beautiful string s for his birthday, the string ...
- WC2019游记 && 课件
WC2019 游记 课件 wc2019.zip_免费高速下载|百度网盘-分享无限制 提取码: un6z day 0 打飞机去广州... 在飞机上刷了爱乐(le)之城, 相当好看... 广二好大! 哈三 ...
- micro-fusion & macro-fusion
micro-fusion 随着技术的发展,CPU内部指令处理单元(execution unit)以及端口(port)增多,在Pentium 4的时候,发出到Execution Unit的μops的th ...
- #195 game(动态规划+二分)
考虑第一问的部分分.显然设f[i]为i子树从根开始扩展的所需步数,考虑根节点的扩展顺序,显然应该按儿子子树所需步数从大到小进行扩展,将其排序即可. 要做到n=3e5,考虑换根dp.计算某点答案时先将其 ...
- 第四十天 并发编程之io模型
一.今日内容 1.网络IO的两个阶段 waitdata copydata 2阻塞IO模型 之前写的都是阻塞 无论多线程 多进程 还是 进程池 线程池 3.非阻塞IO模型 在非阻塞IO中 需要不断循环询 ...
- BZOJ 4326 运输计划
二分答案+树链剖分+树上差分 我们假设x是最小的花费,可以想到给定x,所有运输计划中花费大于x的计划必须经过虫洞,且最长的一条的花费减去虫洞所在边的花费要小于等于x 那么对于x,虫洞所在的位置肯定是确 ...
- hbase系列
jvmhttps://www.cnblogs.com/jiyukai/p/6665199.html hbase https://blog.csdn.net/lizhitao/article/detai ...
- 网络流24(san)题题解汇总
开坑(烂尾预定 1.餐巾计划问题 题解 2.最小路径覆盖问题 题解 3.试题库问题 题解 4.[CTSC1999]家园 题解 5.骑士共存问题 题解 6.最长不下降子序列问题 题解 7.深海机器人问题 ...