Ubuntu 20.04 + ROS Noetic + OpenCV 4.10编译kalibr相机标定功能包

环境:Ubuntu 20.04 + ROS Noetic + OpenCV:4.2.0

1、创建工作空间

mkdir -p kalibr_ws/src
cd kalibr_ws/ 
source /opt/ros/noetic/setup.bash 
cd src/ 
catkin_init_workspace 

2、下载kalibr源码并编译

git clone https://github.com/ethz-asl/kalibr.git 
cd .. 
catkin_make -DCMAKE_BUILD_TYPE=Release -j4

编译过程中遇到相关问题:

  • Could not find a package configuration file provided by "boost_python3"

解决方法:

https://github.com/ethz-asl/kalibr/issues/368

/kalibr/Schweizer-Messer/numpy_eigen/cmake/add_python_export_library.cmake:89 
change 
	list(APPEND BOOST_COMPONENTS python3) 
to 
	list(APPEND BOOST_COMPONENTS python)
  • /usr/include/python3.8/numpy/__multiarray_api.h:1541:35: error: return-statement with a value, in function returning ‘void’ [-fpermissive]

1541 | #define NUMPY_IMPORT_ARRAY_RETVAL NULL

解决方法:

https://blog.csdn.net/zhaodeming000/article/details/119859124

在文件中kalibr/Schweizer-Messer/numpy_eigen/src/autogen_module/numpy_eigen_export_module.cpp添加

BOOST_PYTHON_MODULE(libnumpy_eigen) 
{ 
	using namespace boost::python;
    // Without this import, the converter will segfault 
    #undef NUMPY_IMPORT_ARRAY_RETVAL 
    #define NUMPY_IMPORT_ARRAY_RETVAL
    
    import_array();
  • /home/ubuntu/kalibr_ws/src/kalibr/aslam_offline_calibration/ethz_apriltag2/src/example/apriltags_demo.cpp:53:10: fatal error: libv4l2.h: No such file or directory

    53 | #include <libv4l2.h>

解决方法:

sudo apt-get install libv4l-dev
  • error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope 305 | m_cap.set(CV_CAP_PROP_FRAME_WIDTH, m_width);

解决方法:

https://blog.csdn.net/CGJustDoIT/article/details/108150459

在kalibr_ws/src/kalibr/aslam_offline_calibration/ethz_apriltag2/src/example/apriltags_demo.cpp中添加:

#include <opencv2/highgui/highgui_c.h>
#include <opencv2/imgproc/types_c.h>

using namespace std; 
#include <iostream> 
#include <cstring> 
#include <vector> 
#include <sys/time.h> 
#include <opencv2/highgui/highgui_c.h> 
#include <opencv2/imgproc/types_c.h> 


const string usage = "\n"     
    m_cap.set(cv::CAP_PROP_FRAME_WIDTH, m_width);    
	m_cap.set(cv::CAP_PROP_FRAME_HEIGHT, m_height);    
	cout << "Camera successfully opened (ignore error messages above...)" << endl;   
	cout << "Actual resolution: "         
        << m_cap.get(cv::CAP_PROP_FRAME_WIDTH) << "x"         
        << m_cap.get(cv::CAP_PROP_FRAME_HEIGHT) << endl;
  • error: ‘pid_t gettid()’ was declared ‘extern’ and later ‘static’ [-fpermissive]

img

解决方法:

  • error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope

    22 | _mask = cv::imread(maskFile, CV_LOAD_IMAGE_GRAYSCALE);

  • /usr/include/boost/python/detail/destroy.hpp:20:9: error: ‘Eigen::MatrixBase<Derived>::~MatrixBase()

解决方法:

https://blog.csdn.net/weixin_48135525/article/details/117999358

change line 466 protected intopublic in /usr/include/eigen3/Eigen/src/Core/MatrixBase.h or /usr/local/include/eigen3/Eigen/src/Core/MatrixBase.h.

3、编译成功

  • 8
    点赞
  • 31
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一见如故hbzjt2012

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值