当前位置: 首页 > 编程日记 > 正文

TermCriteria模板类

学习写vo过程中遇到的   类功能:模板类,作为迭代算法的终止条件。

构造函数:

TermCriteria(int type,int maxCount,double epsilon);

参数说明:

type              迭代终止条件类型

type=TermCriteria::MAX_ITER/TermCriteria::COUNT  迭代到最大迭代次数终止

type= TermCriteria::EPS   迭代到阈值终止

type= TermCriteria::MAX_ITER+ TermCriteria::EPS 上述两者都作为迭代终止条件

maxCount   迭代的最大次数

epsilon        阈值(中心位移值)

调用参考:

cv::TermCriteria criteria(cv::TermCriteria::MAX_ITER,10,0.01);

TermCriteria termcrit=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS,30,0.01);

在opencv type.hpp中兼有此类魔板

/** @brief The class defining termination criteria for iterative algorithms.You can initialize it by default constructor and then override any parameters, or the structure may
be fully initialized using the advanced variant of the constructor.
*/
class CV_EXPORTS TermCriteria
{
public:/**Criteria type, can be one of: COUNT, EPS or COUNT + EPS*/enum Type{COUNT=1, //!< the maximum number of iterations or elements to computeMAX_ITER=COUNT, //!< dittoEPS=2 //!< the desired accuracy or change in parameters at which the iterative algorithm stops};//! default constructorTermCriteria();/**@param type The type of termination criteria, one of TermCriteria::Type@param maxCount The maximum number of iterations or elements to compute.@param epsilon The desired accuracy or change in parameters at which the iterative algorithm stops.*/TermCriteria(int type, int maxCount, double epsilon);int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPSint maxCount; // the maximum number of iterations/elementsdouble epsilon; // the desired accuracy
};

光流法:调用模板类TermCriteria对象termcrit

 calcOpticalFlowPyrLK(img_1,img_2,points1,points2,
status,err,winSize,3,termcrit,0,0.001);
@note-   An example using the Lucas-Kanade optical flow algorithm can be found atopencv_source_code/samples/cpp/lkdemo.cpp
-   (Python) An example using the Lucas-Kanade optical flow algorithm can be found atopencv_source_code/samples/python/lk_track.py
-   (Python) An example using the Lucas-Kanade tracker for homography matching can be found atopencv_source_code/samples/python/lk_homography.py*/
CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg,InputArray prevPts, InputOutputArray nextPts,OutputArray status, OutputArray err,Size winSize = Size(21,21), int maxLevel = 3,TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01),int flags = 0, double minEigThreshold = 1e-4 );/** @brief Computes a dense optical flow using the Gunnar Farneback's algorithm.@param prev first 8-bit single-channel input image.
@param next second input image of the same size and the same type as prev.
@param flow computed flow image that has the same size as prev and type CV_32FC2.
@param pyr_scale parameter, specifying the image scale (\<1) to build pyramids for each image;
pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous
one.
@param levels number of pyramid layers including the initial image; levels=1 means that no extra
layers are created and only the original images are used.
@param winsize averaging window size; larger values increase the algorithm robustness to image
noise and give more chances for fast motion detection, but yield more blurred motion field.
@param iterations number of iterations the algorithm does at each pyramid level.
@param poly_n size of the pixel neighborhood used to find polynomial expansion in each pixel;
larger values mean that the image will be approximated with smoother surfaces, yielding more
robust algorithm and more blurred motion field, typically poly_n =5 or 7.
@param poly_sigma standard deviation of the Gaussian that is used to smooth derivatives used as a
basis for the polynomial expansion; for poly_n=5, you can set poly_sigma=1.1, for poly_n=7, a
good value would be poly_sigma=1.5.
@param flags operation flags that can be a combination of the following:-   **OPTFLOW_USE_INITIAL_FLOW** uses the input flow as an initial flow approximation.-   **OPTFLOW_FARNEBACK_GAUSSIAN** uses the Gaussian \f$\texttt{winsize}\times\texttt{winsize}\f$filter instead of a box filter of the same size for optical flow estimation; usually, thisoption gives z more accurate flow than with a box filter, at the cost of lower speed;normally, winsize for a Gaussian window should be set to a larger value to achieve the samelevel of robustness.The function finds an optical flow for each prev pixel using the @cite Farneback2003 algorithm so that\f[\texttt{prev} (y,x)  \sim \texttt{next} ( y + \texttt{flow} (y,x)[1],  x + \texttt{flow} (y,x)[0])\f]

相关文章:

SQL优化快速入门

最近遇到一个专门进行SQL技术优化的项目&#xff0c;对很多既有的老存储过程进行调优&#xff08;现在已经不再新增任何存储过程&#xff09;&#xff0c;因此系统的对SQL语句编写进行一次科学的学习变得很有必要。这儿将基于黄德承大神的Oracle SQL语句优化一书&#xff0c;选…

【HDU】4509 湫湫系列故事——减肥记II (区间覆盖 暴力)

http://acm.hdu.edu.cn/showproblem.php?pid4509 给出的时间段是被占用的时间&#xff0c;24h 1440 min&#xff0c;求出这些区间以外的区间长度 把00&#xff1a;00 - 23&#xff1a;59 变成0-1440 1-5都是被占用的区域&#xff0c;暴力很好理解 #include <iostream>…

Java并发编程71道面试题及答案

Java并发编程71道面试题及答案 1、在java中守护线程和本地线程区别&#xff1f; java中的线程分为两种&#xff1a;守护线程&#xff08;Daemon&#xff09;和用户线程&#xff08;User&#xff09;。 任何线程都可以设置为守护线程和用户线程&#xff0c;通过方法Thread.setDa…

USB获取图像实时处理

手写&#xff36;&#xff2f;的准备工作&#xff0c;调用&#xff35;&#xff21;&#xff22;或者本地相机获取视频图像&#xff0c;读取并保存视频。 #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include "openc…

常见数据库 性能

2019独角兽企业重金招聘Python工程师标准>>> 转载于:https://my.oschina.net/u/582827/blog/778908

【Codeforces】1093C Mishka and the Last Exam

http://codeforces.com/problemset/problem/1093/C 已知b[i]求a[i]和a[n-i1]&#xff0c;n是a数组中元素的个数&#xff0c;a数组的下标从1开始 输出b[1]的时候&#xff0c;直接让a[1] 0&#xff0c;a[n] b[0] 接下来的每一组&#xff0c;先让a[i] b[i]&#xff0c;然后求…

PHP面试常考内容之Memcache和Redis(2)

你好&#xff0c;是我琉忆。继周一&#xff08;2019.2-18&#xff09;发布的“PHP面试常考内容之Memcache和Redis&#xff08;1&#xff09;”后&#xff0c;这是第二篇&#xff0c;感谢你的支持和阅读。本周&#xff08;2019.2-18至2-22&#xff09;的文章内容点为以下几点&am…

毫米波雷达、ADAS中的应用以及毫米波雷达的检测、测距、测速和角度测量

毫米波雷达的检测、测距、测速和角度测量 毫米波(Millimeter-Wave&#xff0c;缩写&#xff1a;MMW)&#xff0c;是指长度在1~10mm的电磁波&#xff0c;对应的频率范围为30~300GHz&#xff0e;根据波的传播理论&#xff0c;频率越高&#xff0c;波长越短&#xff0c;分辨率越高…

【VMC实验室】在QCloud上创建您的SQL Cluster(1)

在国内公有云厂商上搭建一套SQL Cluster的难度相信做Windows的童鞋都会很清楚&#xff0c;并非它的搭建有多少难度&#xff0c;只是很多细节需要注意。腾讯云&#xff0c;QCloud&#xff0c;为什么选择QCloud来做这个实验&#xff0c;除了QCloud是我的东家&#xff08;啊呸&…

【Codeforces】808D Array Division(前后两部分和相等)

http://codeforces.com/contest/808/problem/D 给你一个数组&#xff0c;问&#xff1a;是否可以通过移动一个数字的位置&#xff0c;求只能移动一次&#xff0c;使得这个数组前后部分的和相等&#xff0c;前后部分不一定等长 一个a数组储存数据&#xff0c;另一个b数组b[i]表…

想要确保架构目标达成?适合度函数了解一下

Paula Paul和Rosemary Wang撰写的一篇博文中介绍了适应度函数&#xff08;fitness function&#xff09;的基本概念、入门方法&#xff0c;并给出了如何验证各种架构质量的一些实例。文中提出&#xff0c;适应度函数驱动开发的方法可用于编写测定系统符合架构目标的测试&#x…

标定(二)----------双目相机与IMU联合标定(工具箱使用方法——Kalibr)

16个相机参数&#xff1a; Overview ethz-asl/kalibr is a toolbox that solves the following calibration problems: Multiple camera calibration: intrinsic and extrinsic calibration of a camera-systems with non-globally shared overlapping fields of view Cam…

【Codeforces】659B Qualifying Contest (sort)

http://codeforces.com/problemset/problem/659/B n个人&#xff0c;m个地区&#xff0c;选出每个地区分数最高的两个人 下面有n行&#xff0c;每一行的第一个数表示姓名&#xff0c;第二个数是地区的序号&#xff0c;第三个数是分数 It is guaranteed that all surnames of…

Protractor测试环境搭建

2019独角兽企业重金招聘Python工程师标准>>> 安装node.js.然后&#xff0c;在cmd下&#xff0c;进入E盘下的&#xff0c;我们自己新建的protractor文件夹下&#xff0c; npm install -g protractor 这样就会在本地安装好两个命令行工具&#xff1a;protractor和webd…

Promise和Promise的方法

&#xff08;Promise和Promise的方法&#xff09; Promise是ES6一个伟大的发明&#xff0c;他使我们从回调地狱中能够走出来。 什么是Promise 从字面上来看&#xff0c;Promise就是一个承诺。那么&#xff0c;在ES6当中&#xff0c;Promise通常用来控制异步操作。当一个异步操作…

镜头评价指标及测试方法(三)--------测量原理及3D相机调查

1.测量原理&#xff1a; 1.1、通过红外结构光(Structured Light)来测量像素距离&#xff0c;如Kinect1、Project Tango1、Intel Realsense等&#xff1b; 通过近红外激光器&#xff0c;将具有一定结构特征的光&#xff08;比如离散光斑、条纹光、编码结构光等&#xff09;投射到…

Android--Retrofit的简单使用(一)

1&#xff0c;如果不太了解retrofit的同学可以先去官网学习一下简单使用&#xff1a;http://square.github.io/retrofit/&#xff0c;这里我们以一个简单的Get请求的例子来练习一下 2&#xff0c;https://api.douban.com/v2/movie/top250?start0&count10 目标地址&#xf…

【Codeforces】920A Water The Garden(浇花)

http://codeforces.com/problemset/problem/920/A 给你花坛的数目&#xff0c;花坛都是连续的&#xff0c;某一些花坛里有水龙头&#xff0c;给出了这些有水龙头的位置 The garden from test 1. White colour denotes a garden bed without a tap, red colour — a garden be…

Work with Alexa :Echo匹配连接到Alexa

背景&#xff1a; 通过蓝牙可以让你的智能家居设备和Echo设备连接起来&#xff0c;从而达到Echo通过语音控制智能家居设备。 什么事Alexa Gadgets&#xff1f; 我的理解Alexa Gadgets是智能家居设备的一部分&#xff0c;包含硬件和软件。硬件&#xff1a;蓝牙模块&#xff1b;软…

Maven 学习Tips

2019独角兽企业重金招聘Python工程师标准>>> 使用 deploy 应该注意的地方 在项目的pom文件中增加如下节点&#xff1a;<project><distributionManagement><repository><id>releases</id><url>http://192.168.1.99:8081/nexus/c…

【Codeforces】1015B Obtaining the String(字符串 交换)

http://codeforces.com/contest/1015/problem/B n 表示 字符串的长度 然后是两个字符串&#xff0c;每一次只能交换相邻的两个&#xff0c;如果选择第i个字符的话&#xff0c;只能交换第i个和第i1个 然后输出每一次交换选定的位置 暴力&#xff0c;模拟&#xff0c;queue&am…

07 分支管理 —— Feature分支

2019独角兽企业重金招聘Python工程师标准>>> 07 分支管理 —— Feature分支 软件开发中&#xff0c;总有无穷无尽的新的功能要不断添加进来。添加一个新功能时&#xff0c;你肯定不希望因为一些实验性质的代码&#xff0c;把主分支搞乱了&#xff0c;所以&#xff0…

适用于0基础小伙伴的HTML知识点总结 先到先得哟

HTML基础知识点分享 前段时间一直忙于私下学习消化一些PHP中的知识体系&#xff0c;导致博客开通至今一直没发表相关技能贴。最近呢~博主夏天我正在进行前半段知识体系和框架的总结阶段。借此&#xff0c;抽空给大家分享一下私下自己学习时的一些心得体会以及知识体系&#xff…

SLAM小结——求解退化问题解析(F、H、E)(面试经验总结)

总结&#xff1a; 1 Essential Matrix E t ^ R 为3*3的矩阵&#xff0c;奇异值为 [ u, u, 0] ^ T 的形式。为本质矩阵的内在性质。 性质&#xff1a;理论上综合旋转、平移共有6个自由度&#xff0c;因尺度等价&#xff0c;E有5个自由度。 求解&#xff1a;一般使用…

【Codeforces】1065B Vasya and Isolated Vertices (无向图的)

http://codeforces.com/problemset/problem/1065/B 一个图&#xff0c;给定顶点数&#xff0c;边数&#xff0c;求解最小孤立点数和最大孤立点数 最小的话&#xff0c;一个边连接两个顶点成为一个整体&#xff0c;如果最后有多余的点&#xff0c;那些就是孤立的点 最大就是找…

这些资源网站为什么能获得5万知乎大佬推荐,而我错失了什么吗?

现在很多朋友可能只要是一听到资源网站&#xff0c;想必就会好奇是什么网站&#xff0c;用用看是不是由说的那么厉害&#xff01;其实资源网站给我们的诱惑是在是太大了&#xff0c;其主要原因是可以帮助我们搜索到很多意想不到的资源&#xff01; 为了回应大家的需求&#xff…

大话Redis进阶

2019独角兽企业重金招聘Python工程师标准>>> 使用Redis过程中&#xff0c;总是会遇到各种各样问题&#xff0c;这里进行问题的总结&#xff0c;作为Redis 进阶的经验分享。 更新缓存的问题 [主动]需要操作人员去操作&#xff0c;或者定时调度[被动]由用户触发更新[预…

SLAM精度测评——EVO

1.install GitHub - MichaelGrupp/evo: Python package for the evaluation of odometry and SLAM 注意&#xff1a;安装好依赖&#xff01; sudo apt install python-pip pip install evo --upgrade --no-binary evo or pip install evo --upgrade --no-binary evo --user…

【UVA】10152 ShellSort (几只乌龟的故事)

https://vjudge.net/problem/UVA-10152 题目大意&#xff1a; 输入N&#xff0c;给你N个乌龟的名字&#xff0c;下面N行是初始状态&#xff0c;在下面N行是最终状态&#xff0c;你选中这只乌龟以后&#xff0c;只能把它移动到最上面&#xff0c;问怎么样操作步数最少&#xf…

python2与python3转换记录

为什么需要有两个版本的Python Python2和Python3不兼容是每个接触过Python的开发者都知道的事&#xff0c;虽说Python3是未来&#xff0c;但是仍然有很多项目采用Python2开发。Linux的许多发行版本(如Ubuntu)都会自带Python2.7&#xff0c;但是当我们准备开发一个Python3项目的…