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() :
- 对象已经被释放时释放指针
- 智能指针内部的对象指针正好为NULL时触发(etc. 调用的函数正好返回NULL)
- delete_obj():引用计数为零时自动被调用(用于释放指针?)。必要时需要自定义内容
The cv::Exception class and exception handling
- 异常类,和标准库的异常类似
- 成员:
- code: 数字表示的错误代码
- err:string指示生成异常的错误的性质
- func:string表示发生异常的函数名称
- file:string表示发生异常的文件名
- 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
- 数据模板,用于函数间传递特殊的数据类型
- 同时包含该类型的运行时信息和在编译时指向相同类型