1. 程式人生 > >ORB-SLAM2中使用ROS遇到Bad argument (Invalid pointer to file storage) in cvGetFileNodeByName

ORB-SLAM2中使用ROS遇到Bad argument (Invalid pointer to file storage) in cvGetFileNodeByName

在最近的除錯程式碼中,有一個問題Bad argument (Invalid pointer to file storage) in cvGetFileNodeByName困擾了我一段時間,查詢國內的方案也沒有找到方法。在尋找了github的問答中,有人提出瞭解決方案,且親測可行。

https://github.com/raulmur/ORB_SLAM2/issues/103

Ok with two days of struggling here is my solution: First my environment:

Ubuntu 1604 under VMware ROS Kinetic OpenCV 2.4.10

I first tried to compile ORB_SLAM with the OpenCV3.1.0 inside ROS follow the introduction provided by@cmxnono, however error occurs while cmake:

  1. CMake Error in CMakeLists.txt:

  2. Imported target "opencv_xphoto" includes non-existent path

  3. "/usr/include/opencv-3.1.0-dev/opencv"

  4. in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

  5. * The path was deleted, renamed, or moved to another location.

  6. * An install or uninstall procedure did not complete successfully.

  7. * The installation package was faulty and references files it does not

  8. provide.

, as the make also failed unsurprisingly. I didn't spend lots of time on figure out why this happens (someone knows? ). Instead, I determine to install another OpenCV 3.1.0 aside of my original 2.4.10, into the path, say \home\jack\libs\opencv

, then change findpackage for OpenCV in CMakeList.txt of ORB_SLAM to

  find_package(OpenCV 3 REQUIRED HINTS ${OpenCV_DIR} NO_DEFAULT_PATH)

After compile the ORB_SLAM again, change the opencv version for ros node to 3, too, then everything goes well for me.

By the way, I also tried to convert the rosbuild CMakeList file to catking_make version, it's doesn't help on this problem.

一般這個問題出現在編譯ORB-SLAM2與編譯ros版本的opencv版本不同,一個為2.4.8一個為kinetic自帶的3.2.0。只要在cmakelist中講opencv那一行統一為ros的3.2.0即可

find_package(OpenCV 3.2.0 REQUIRED)

--------------------- 作者:yuan2477281 來源:CSDN 原文:https://blog.csdn.net/yuan2477281/article/details/78060358?utm_source=copy 版權宣告:本文為博主原創文章,轉載請附上博文連結!