学习写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]

TermCriteria模板类相关推荐

  1. OpenCV中的TermCriteria模板类

    2019独角兽企业重金招聘Python工程师标准>>> TermCriteria模板类,取代了之前的CvTermCriteria,这个类是作为迭代算法的终止条件的,这个类在参考手册里 ...

  2. OpenCV cv::TermCriteria 模板类

    OpenCV cv:: TermCriteria 迭代求解结构 头文件 TermCriteria类定义在 /core/types.hpp 中 成员变量 enum { COUNT=1, //计算元素或者 ...

  3. Eigen(1):Matrix模板类

    Matrix是一个模板类,利用模板类可以定义矩阵类. 矩阵类模板: 1Matrix类有6个模板参数,只需要了解前3个就好了. Matrix<typename Scalar, int RowsAt ...

  4. Google Test(GTest)使用方法和源码解析——模板类测试技术分析和应用

    写C++难免会遇到模板问题,如果要针对一个模板类进行测试,似乎之前博文中介绍的方式只能傻乎乎的一个一个特化类型后再进行测试.其实GTest提供了两种测试模板类的方法,本文我们将介绍方法的使用,并分析其 ...

  5. C++编程进阶7(何时使用成员函数模板,模板类的实参推断与类型转换、继承与数组)

    二十六.何时使用成员函数模板 关于成员函数模板见https://blog.csdn.net/Master_Cui/article/details/111824152 成员函数模板主要用来兼容不同类型的 ...

  6. C++知识点61——typename与class、模板编程与继承、模板类和友元、类模板与static成员

    一.typename与class的异同 1.啥时候既可以使用typename,又可以使用class? 当表示模板参数的时候,二者没有区别 2.啥时候只能使用typename,不能使用class? 当模 ...

  7. C++知识点56——类模板(1、模板类的介绍)

    一.类模板 和函数模板一样,类模板也得通过template关键字来声明和定义,C++标准库中有很多容器都是类模板 示例 template <typename T> class mystac ...

  8. c++ 以模板类作为参数的模板

    我想写一个以模板类做为参数的模板,,可惜...没成功. 1.从模板参数到模板:这个简单: //类A是一个模板 template<class T> class A{ } ; //类B,想使用 ...

  9. 模板类中使用友元函数的方式,派生类友元函数对基类的成员使用情况

    在一般友元函数的前面加上 template<typename T),注意在函数的声明和定义处都要加这个模板 例如: //模板类,长方体类 template <typename Elemen ...

最新文章

  1. 获取java hashCode分布
  2. SAP 操作,弹出报错 - 已根据规则拒绝服务器触发的操作,是否要查看上个通讯步骤中触发的操作列表 -
  3. JScript多语言语法加亮引擎显示(代码精简)
  4. poj2976Dropping tests (二分搜索+还是涉及昨天遇见的o1分数规划)
  5. Razor Templating Engine
  6. Codeforses 185 A Plant 思维 规律
  7. ElementUI分页组件的封装
  8. ORM仇恨者无法理解
  9. 华为做raid5步骤_华为验厂验厂流程如何?主要内容是什么呢?
  10. laravel项目中css样式表的背景图片不显示
  11. html点击事件传参 php,HTML通过事件传递参数到js详解及实例
  12. c语言程序40例,C语言程序讲解40例.pdf
  13. 【转】什么是线程安全和线程不安全
  14. Oracle数据泵的使用
  15. 三菱驱动器参数表_三菱伺服驱动器参数设置CM100TJ-24F
  16. linux 使用 雅黑字体,linux 使用微软雅黑字体
  17. 腾讯与360之争随笔 (12月21日,最后一次更新)
  18. windows server2008 部署项目环境总结
  19. 【转】《与MySQL的零距离接触》第二章:数据类型与操作数据表 (2-9:MySQL记录的插入与查找)
  20. 《用户至上:用户研究方法与实践》用户体验入门

热门文章

  1. springboot 打包_springboot项目打包上传至阿里云服务器
  2. C++:map用法示例
  3. PCL分割:Conditional Euclidean Clustering官方历程,在自己配置环境上调错
  4. keras 的 example 文件 conv_lstm.py 解析
  5. 小R SLAM机器人基本命令
  6. POJ - 1661 Help Jimmy DP
  7. 深度学习--TensorFlow(3)线性神经网络(线性输入非线性输入)(实现)
  8. 数据结构与算法(7-4)最短路径(迪杰斯特拉(Dijkstra)算法、弗洛伊德(Floyd)算法)
  9. Matlab图像复原(运动模糊、散焦模糊)
  10. bootstrap 新闻列表_kuapingUI 2.2 版本发布,跨屏 UI-bootstrap 大组件 UI 框架