Я хочу собрать свой проект (в ROS), используя opencv 2.4
Я установил версию ros-kinetic и пакет opencv3 (по умолчанию через libopencv-dev ros-kinetic-opencv3 доступен только opencv3).Для моего проекта мне нужна версия opencv-2.4.Я пытаюсь несколькими способами (через CMakelists.txt
моего проекта и т. Д.) Связать с моим пользовательским opencv (в usr/local/include
), но безуспешно.
Мой проект всегда связывается с установленным ros opencv (/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2)
Я получил следующие ошибки
/usr/include/c++/5/bits/stl_vector.h:913:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = Eigen::Matrix<double, 3, 1>; _Alloc = Eigen::aligned_allocator_indirection<Eigen::Matrix<double, 3, 1> >; std::vector<_Tp, _Alloc>::value_type = Eigen::Matrix<double, 3, 1>]
push_back(const value_type& __x)
^
/usr/include/c++/5/bits/stl_vector.h:913:7: note: no known conversion for argument 1 from ‘cv::Point {aka cv::Point_<int>}’ to ‘const value_type& {aka const Eigen::Matrix<double, 3, 1>&}’
/home/user1/user1/catkin_ws/src/rgbd_calibration/src/rgbd_calibration/calibration_test.cpp:1107:79: error: no matching function for call to ‘std::vector<Eigen::Matrix<double, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 3, 1> > >::push_back(cv::Point)’
points.push_back(cv::Point(tmp_corners[35].x(), tmp_corners[35].y()));
^
In file included from /usr/include/c++/5/vector:64:0,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/base/matrix.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/base/point_matrix.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/objects/globals.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/objects/base_object.h:33,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/objects/sensor.h:21,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/color/sensor.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/pinhole/sensor.h:32,
from /home/user1/user1/catkin_ws/src/rgbd_calibration/include/rgbd_calibration/calibration_test.h:21,
from /home/user1/user1/catkin_ws/src/rgbd_calibration/src/rgbd_calibration/calibration_test.cpp:18:
/usr/include/c++/5/bits/stl_vector.h:913:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = Eigen::Matrix<double, 3, 1>; _Alloc = Eigen::aligned_allocator_indirection<Eigen::Matrix<double, 3, 1> >; std::vector<_Tp, _Alloc>::value_type = Eigen::Matrix<double, 3, 1>]
push_back(const value_type& __x)
^
/usr/include/c++/5/bits/stl_vector.h:913:7: note: no known conversion for argument 1 from ‘cv::Point {aka cv::Point_<int>}’ to ‘const value_type& {aka const Eigen::Matrix<double, 3, 1>&}’
/home/user1/user1/catkin_ws/src/rgbd_calibration/src/rgbd_calibration/calibration_test.cpp:1108:79: error: no matching function for call to ‘std::vector<Eigen::Matrix<double, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 3, 1> > >::push_back(cv::Point)’
points.push_back(cv::Point(tmp_corners[30].x(), tmp_corners[30].y()));
^
In file included from /usr/include/c++/5/vector:64:0,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/base/matrix.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/base/point_matrix.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/objects/globals.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/objects/base_object.h:33,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/objects/sensor.h:21,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/color/sensor.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/pinhole/sensor.h:32,
from /home/user1/user1/catkin_ws/src/rgbd_calibration/include/rgbd_calibration/calibration_test.h:21,
from /home/user1/user1/catkin_ws/src/rgbd_calibration/src/rgbd_calibration/calibration_test.cpp:18:
/usr/include/c++/5/bits/stl_vector.h:913:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = Eigen::Matrix<double, 3, 1>; _Alloc = Eigen::aligned_allocator_indirection<Eigen::Matrix<double, 3, 1> >; std::vector<_Tp, _Alloc>::value_type = Eigen::Matrix<double, 3, 1>]
push_back(const value_type& __x)
^
/usr/include/c++/5/bits/stl_vector.h:913:7: note: no known conversion for argument 1 from ‘cv::Point {aka cv::Point_<int>}’ to ‘const value_type& {aka const Eigen::Matrix<double, 3, 1>&}’
/home/user1/user1/catkin_ws/src/rgbd_calibration/src/rgbd_calibration/calibration_test.cpp:1110:113: error: no matching function for call to ‘fillConvexPoly(cv::Mat&, std::vector<Eigen::Matrix<double, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 3, 1> > >&, cv::Scalar)’
cv::fillConvexPoly(tmp_image, points, cv::Scalar(c == 0 ? 128 : 0, c == 1 ? 128 : 0, c == 2 ? 128 : 0));
^
In file included from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/imgproc/imgproc.hpp:48:0,
from /opt/ros/kinetic/include/image_geometry/pinhole_camera_model.h:6,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/pinhole/camera_model.h:32,
from /home/user1/user1/catkin_ws/src/calibration_toolkit/calibration_common/include/calibration_common/pinhole/sensor.h:33,
from /home/user1/user1/catkin_ws/src/rgbd_calibration/include/rgbd_calibration/calibration_test.h:21,
from /home/user1/user1/catkin_ws/src/rgbd_calibration/src/rgbd_calibration/calibration_test.cpp:18:
/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/imgproc.hpp:4452:17: note: candidate: void cv::fillConvexPoly(cv::Mat&, const Point*, int, const Scalar&, int, int)
CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts,
^
/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/imgproc.hpp:4452:17: note: candidate expects 6 arguments, 3 provided
/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/imgproc.hpp:4469:19: note: candidate: void cv::fillConvexPoly(cv::InputOutputArray, cv::InputArray, const Scalar&, int, int)
CV_EXPORTS_W void fillConvexPoly(InputOutputArray img, InputArray points,
^
/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/imgproc.hpp:4469:19: note: no known conversion for argument 2 from ‘std::vector<Eigen::Matrix<double, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 3, 1> > >’ to ‘cv::InputArray {aka const cv::_InputArray&}’
rgbd_calibration/CMakeFiles/test_calibration.dir/build.make:62: recipe for target 'rgbd_calibration/CMakeFiles/test_calibration.dir/src/rgbd_calibration/test_node.cpp.o' failed
make[2]: *** [rgbd_calibration/CMakeFiles/test_calibration.dir/src/rgbd_calibration/test_node.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
rgbd_calibration/CMakeFiles/test_calibration.dir/build.make:86: recipe for target 'rgbd_calibration/CMakeFiles/test_calibration.dir/src/rgbd_calibration/calibration_test.cpp.o' failed
make[2]: *** [rgbd_calibration/CMakeFiles/test_calibration.dir/src/rgbd_calibration/calibration_test.cpp.o] Error 1
CMakeFiles/Makefile2:3448: recipe for target 'rgbd_calibration/CMakeFiles/test_calibration.dir/all' failed
make[1]: *** [rgbd_calibration/CMakeFiles/test_calibration.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 98%] Linking CXX executable /home/user1/user1/catkin_ws/devel/lib/rgbd_calibration/rgbd_offline_calibration
[ 98%] Built target rgbd_offline_calibration
Makefile:138: recipe for target 'all' failed
Я попробовал несколько вещей, например вставку find_package(OpenCV 2.4.12 REQUIRED
NO_MODULE #Should be optional, tells CMake to use config mode
PATHS /usr/local # Tells CMake to look here
NO_DEFAULT_PATH #and don't look anywhere else
)
в CMakeLists.txt
проекта, но все еще та же проблема.
Есть ли безопасный способ явной ссылки на мой пользовательский opencv?