报错:
terminate called after throwing an instance of ‘std::runtime_error’
what(): Frame: provided image has not the same size as the camera model or image is not grayscale
解决:
经过调试发现是这句的问题:
vo_->addImage(img, msg->header.stamp.toSec());
调用FrameHandlerMono::addImage函数(定义在frame_handler_mono.cpp中)
其中,msg->header.stamp.toSec()可获取系统时间(以秒为单位)
获取的图片img和转换的系统时间被传入函数addImage,addImage过程:
可是我刚刚把格式从mono改成了rgb格式,现在又要用这个函数。。。咋办
frame_handler_mono.cpp中:new_frame_.reset(new Frame(cam_, img.clone(), timestamp));
这句有问题。
先看报的错 第一种可能:provided image has not the same size as the camera model
提供的图像和camera的模型不一样。
https://github.com/uzh-rpg/rpg_svo/wiki/Camera-Calibration
http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration
相机标定
使用第2个模型
rosdep报错:
// rosdep报错
rosdep install camera_calibration
ERROR: Rosdep cannot find all required resources to answer your query
Missing resource camera_calibration
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/mxy/leishen_ws/src
ROS path [2]=/opt/ros/melodic/share
是因为我没有安装camera_calibration。安完了又显示
Could not find a package configuration file provided by “image_geometry”
再安image_geometry
又提示没有stereo-msgs
sudo apt-get install ros-melodic-stereo-msgs
// 新的报错
CMake Error at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1947 (message):
Unable to find the requested Boost libraries.
Boost version: 1.65.1
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_python37
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
发现自己没有python3.7,于是又安装python3.7(参考:https://blog.csdn.net/qq_25863199/article/details/91125794),切换python版本:
//查看当前版本
$ python --version
是Python 2.7.17
//切换python版本
sudo update-alternatives --config python
结果还是python3.6
继续解决问题:
$ sudo apt-get install python3.7
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
$ sudo update-alternatives --config python
$ python --version
Python 3.7.5!!耶
but!!!!!catkin_make需要的环境是python2.7…
所以,我先把环境变量改成python3.7后,再安装Boost,然后在切换2.7,再编译试试
不行。(最后参考软链接:https://blog.csdn.net/qq_42138662/article/details/105677869)
sudo ln -s libboost_python-py36.so libboost_python37.so
sudo ln -s libboost_python-py36.a libboost_python37.a
```成功。现在依赖的问题解决了,开始程序上报错了
CV_INTER_LINEAR' was not declared in this scope。解决方法 : cv::INTER_LINEAR 替换 CV_INTER_LINEAR
...............................................................................................................