ROS 节点中 OpenCV 4 与 cv_bridge 之间的冲突
Conflict between OpenCV 4 and cv_bridge in ROS Node
我正在用带有 ROS 的 OpenCV 开始一个项目,我需要使用 opencv_contrib 中的 xfeatures2d。我按照 this instructions 并以这种方式修改我的 CMake 文件:
cmake_minimum_required(VERSION 3.0.2)
project(visual_odometry)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
rospy
sensor_msgs
nav_msgs
geometry_msgs
std_msgs
)
find_package(OpenCV 4 REQUIRED)
catkin_package()
include_directories(
# include
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
add_executable(show_image src/show_image.cpp)
target_link_libraries(show_image
${catkin_LIBRARIES}
${OpenCV_LIBRARIES})
add_executable(show_video src/show_video.cpp)
target_link_libraries(show_video
${catkin_LIBRARIES}
${OpenCV_LIBRARIES})
add_executable(visual_Odometry src/visual_Odometry.cpp)
target_link_libraries(visual_Odometry
${catkin_LIBRARIES}
${OpenCV_LIBRARIES})
catkin_make
之后:
/usr/bin/ld: warning: libopencv_imgproc.so.4.5, needed by /usr/local/lib/libopencv_xfeatures2d.so.4.5.3, may conflict with libopencv_imgproc.so.3.2
在运行时间段内,imgproc的一些函数如CLAHE算法失效,导致我的节点停止工作。
当我使用 catkin_make 构建时,cv_bridge 发现 ros 中默认的 opencv3.2,但由于 CMake 文件,我的节点找到了 opencv4。那么,我可以解决这个问题吗?可以在 opencv3.2 中构建 opencv_contrib 吗?可以在 cv_bridge?
中更改 opencv 的版本
我在 Github 中找到了解决方案:
在catkin_ws/src中:
git clone https://github.com/fizyr-forks/vision_opencv/tree/opencv4
cd vision_opencv
git checkout opencv4
我正在用带有 ROS 的 OpenCV 开始一个项目,我需要使用 opencv_contrib 中的 xfeatures2d。我按照 this instructions 并以这种方式修改我的 CMake 文件:
cmake_minimum_required(VERSION 3.0.2)
project(visual_odometry)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
rospy
sensor_msgs
nav_msgs
geometry_msgs
std_msgs
)
find_package(OpenCV 4 REQUIRED)
catkin_package()
include_directories(
# include
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
add_executable(show_image src/show_image.cpp)
target_link_libraries(show_image
${catkin_LIBRARIES}
${OpenCV_LIBRARIES})
add_executable(show_video src/show_video.cpp)
target_link_libraries(show_video
${catkin_LIBRARIES}
${OpenCV_LIBRARIES})
add_executable(visual_Odometry src/visual_Odometry.cpp)
target_link_libraries(visual_Odometry
${catkin_LIBRARIES}
${OpenCV_LIBRARIES})
catkin_make
之后:
/usr/bin/ld: warning: libopencv_imgproc.so.4.5, needed by /usr/local/lib/libopencv_xfeatures2d.so.4.5.3, may conflict with libopencv_imgproc.so.3.2
在运行时间段内,imgproc的一些函数如CLAHE算法失效,导致我的节点停止工作。
当我使用 catkin_make 构建时,cv_bridge 发现 ros 中默认的 opencv3.2,但由于 CMake 文件,我的节点找到了 opencv4。那么,我可以解决这个问题吗?可以在 opencv3.2 中构建 opencv_contrib 吗?可以在 cv_bridge?
中更改 opencv 的版本我在 Github 中找到了解决方案:
在catkin_ws/src中:
git clone https://github.com/fizyr-forks/vision_opencv/tree/opencv4
cd vision_opencv
git checkout opencv4