opencv各种类的定义

来源:互联网 发布:人见人爱网络剧沈腾 编辑:程序博客网 时间:2024/06/12 21:00

  • Helper Objects
    • The cvTermCriteria class
    • The cvRange class
    • The cvPtr template and Garbage Collection 101
    • The cvException class and exception handling
    • The cvDataType template

Helper Objects

The cv::TermCriteria class

  • 算法的终止类(Many algorithms require a stopping condition to know when to quit)
  • 三个参数:int type, int maxCount, double epsilon
  • cv::TermCriteria::COUNT与cv::TermCriteria::MAX_ITER相同。
  • 设定了EPS后,算法的聚合(收敛?)低于该值时停止。

The cv::Range class

  • 用于指定一个连续的整数序列
  • 两个参数:int start, int end
  • 举例:Range(0,4):0,1,2,3

The cv::Ptr template and Garbage Collection 101

  • 智能指针?
  • cv::Ptr p = makePtr()或cv::Ptr p
  • 有和普通指针一样的功能,根据引用计数器释放内存
  • addref() and release():计数增加与减少
  • empty() :
    1. 对象已经被释放时释放指针
    2. 智能指针内部的对象指针正好为NULL时触发(etc. 调用的函数正好返回NULL)
  • delete_obj():引用计数为零时自动被调用(用于释放指针?)。必要时需要自定义内容

The cv::Exception class and exception handling

  • 异常类,和标准库的异常类似
  • 成员:
    1. code: 数字表示的错误代码
    2. err:string指示生成异常的错误的性质
    3. func:string表示发生异常的函数名称
    4. file:string表示发生异常的文件名
    5. line:int表示错误发生的行数
  • CV_Error( errorcode, description ):用一种固定的文本描述生成异常
  • CV_Error_( errorcode, printf_fmt_str, [printf-args] ):使用printf格式输出
  • CV_Assert( condition ) and CV_DbgAssert( condition ):测试条件不满足时抛出异常

The cv::DataType<> template

  • 数据模板,用于函数间传递特殊的数据类型
  • 同时包含该类型的运行时信息和在编译时指向相同类型
0 0