報錯:
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
...............................................................................................................