环境: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]
解决方法:
-
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.