OpenCV Error: Bad argument 错误解决

ubuntu14.04
ros-indigo
opencv3

关于
在编译VINS-MONO时发现问题如图

差不多长这样

OpenCV Error: Bad argument (Invalid pointer to file storage) in cvGetFileNodeBy
Name, file /build/buildd/opencv-2.4.8+dfsg1/modules/core/src/persistence.cpp, lin
e 740                                                         
terminate called after throwing an instance of ‘cv::Exception’
what(): /build/buildd/opencv-2.4.8+dfsg1/modules/core/src/persistence.cpp:740
: error: (-5) Invalid pointer to file storage in function cvGetFileNodeByName
terminate called after throwing an instance of ‘cv::Exception’
what(): /build/buildd/opencv-2.4.8+dfsg1/modules/core/src/persistence.cpp:740
: error: (-5) Invalid pointer to file storage in function cvGetFileNodeByName

查阅资料发现是OpenCV3与ROS兼容问题,因为indigo里面自带的是opencv2.4.8,而我要用的程序是基于opencv3的。

要解决这个问题,方法就是把cv_bridge和image_pipeline下载到本地的工作空间,并重新编译,他们基于OpenCV2可以直接编译成功。

image_pipeline:
https://github.com/ros-perception/image_pipeline

必须要先把旧版本的cv_bridge卸载掉:

sudo apt-get remove ros-indigo-cv-bridge

然后下载新版本的cv_bridge:
https://github.com/ros-perception/vision_opencv.git

然后编译成功,成功运行

猜你喜欢

转载自blog.csdn.net/qq_38269418/article/details/81262422