cv2.fitline_pr自动抽帧

cv2.fitline_pr自动抽帧cv::fitLine用法定义代码示例y=x+1直线y=-x+1直线定义在opencv官方文档定义如下:voidcv::fitLine(InputArraypoints,OutputArrayline,intdistType,doubleparam,doublereps,doubleaeps)#include<opencv2/imgproc.hpp>Fitsalinetoa2Dor3Dpointset.Paramet

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

定义

在opencv官方文档定义如下:

void cv::fitLine(InputArray points,
OutputArray line,
int distType,
double param,
double reps,
double aeps 
)

#include <opencv2/imgproc.hpp>
Fits a line to a 2D or 3D point set.

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 DistanceTypes
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.

Jetbrains全家桶1年46,售后保障稳定

代码示例

简而言之,就是利用已有的点拟合直线,本篇只针对使用做简单示例,基于opencv3.4.5, C++;
主要介绍输出参数,

  • OutputArray line:在二维下为四个元素,前两个为向量(x, y),后两个为拟合直线上的一个点
  • distType,参考如下:
    //! @see distanceTransform, fitLine
    enum DistanceTypes { 
         
        DIST_USER    = -1,  //!< User defined distance
        DIST_L1      = 1,   //!< distance = |x1-x2| + |y1-y2|
        DIST_L2      = 2,   //!< the simple euclidean distance
        DIST_C       = 3,   //!< distance = max(|x1-x2|,|y1-y2|)
        DIST_L12     = 4,   //!< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1))
        DIST_FAIR    = 5,   //!< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998
        DIST_WELSCH  = 6,   //!< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846
        DIST_HUBER   = 7    //!< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345
    };
    
  • param: 默认0,opencv自动优化
  • reps:0.01精度即可
  • aeps:建议0.01,0.01 would be a good default value…

y = x + 1直线

向量(0.707107,0.707107)如图下

控制台输出

calc_line[0]=0.707107
calc_line[0]=0.707107
calc_line[0]=1.5
calc_line[0]=2.5

y = -x + 1直线

向量(0.707107,-0.707107)

calc_line[0]=0.707107
calc_line[0]=-0.707107
calc_line[0]=1.5
calc_line[0]=1.5

Enjoy~

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/234392.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • 【Linux】进程间通信「建议收藏」

    【Linux】进程间通信「建议收藏」目录1.进程间通信1.1.进程间通信的目的1.2.如何实现进程间通信2.管道通信2.1.匿名管道2.1.1创建匿名管道2.1.2.深入理解匿名管道2.2.命名管道2.2.1.创建命名管道3.systemV标准进程间通信3.1.共享内存3.1.1.实现原理3.1.2.代码实现3.2.消息队列(了解)3.2.1实现原理3.3.信号量(了解)3.3.1.实现原理1.进程间通信1.1.

    2022年10月11日
  • Navicat Premium 15激活码【2021免费激活】

    (Navicat Premium 15激活码)这是一篇idea技术相关文章,由全栈君为大家提供,主要知识点是关于2021JetBrains全家桶永久激活码的内容https://javaforall.cn/100143.htmlIntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,上面是详细链接哦~S32PGH0SQB-eyJsaWNlb…

  • 7000笔记本性价比之王(三千元笔记本性价比之王)

    PC市场的出货量频繁爆低,并不意味着这一市场走衰,其依旧是大部分人日常办公和外出携带办公所不可或缺的电子产品。只是换新欲望不强烈,面对并不了解的产品时过于保守的购买态度,严重影响了消费者在更换笔记本电脑的“快、准、狠”。但若真有购机需求时,看到各个价位的各种机型,又无从下手。说多了都是泪啊…哎…不容易~作为90后编辑和在大城市打拼的各位一样,就是个“小白领”。交了房租水电,买了油米泡面。发现,这个…

  • js判断当前操作系统

    js判断当前操作系统

  • Git—记录一次自建git服务器和客户端的过程

    Git—记录一次自建git服务器和客户端的过程系统Windows1064BitCentOS7(服务器)步骤服务器部分新建用户useraddgitgroupaddgit(如果已经存在,就不用理会了)cd/home/gitmkdir.sshtouchauthorized_keysyuminstall-ygit安装gityuminstall-ygit建立仓库找个认为合适的位置mkdir/gitrepocd/gitrepogitinit–baretest.gitcd/ch

  • 每天进步一点点——再次了解Linux进程ID

    每天进步一点点——再次了解Linux进程ID

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号