ros ---ubuntu 18.04安装 kalibr 出现opencv编译出错问题
这是因为 opencv版本不一致的问题。 本机中的opencv >4.0error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope
error: ‘CV_CAP_PROP_FRAME_HEIGHT’ was not declared in this scope
error: ‘CV_BGR2GRAY’ was not declared in this scope
error: ‘cvStartWindowThread’ was not declared in this scope
通用解决办法
方法一
例如:
红色的部分为 未定义的变量/函数
绿色是修改提示,不要使用 !!!
正确修改
m_cap.set(CV_CAP_PROP_FRAME_WIDTH, m_width);
改为
m_cap.set(cv::CV_CAP_PROP_FRAME_WIDTH, m_width);
给每个未找到的变量/函数添加工作空间cv::
然后再根据提示修改!!!
结果如下:
这时候才根据提示修改!!!
方法二
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/imgproc/types_c.h>