ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

[Solved]Conflict opencv different version cv_bridge and xfeatures2d

asked 2021-07-12 08:38:31 -0600

Elektron97 gravatar image

updated 2021-11-30 05:11:50 -0600

Hi everyone. I'm starting a project with OpenCV and i need to use xfeatures2d that is in opencv_contrib. I follow this instructions and modify my CMake File in this way:

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})

After 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

During run time, some functions of imgproc like CLAHE algorithm doesn't work and my node stop to work.

When i build with catkin_make, cv_bridge find opencv3.2 default in ros, but my node find opencv4 thanks to CMake file. So, can I fix this? It is possible build in opencv3.2 a opencv_contrib? It is possibile to change the version of opencv in cv_bridge?

edit retag flag offensive close merge delete

Comments

Add some new informations for my problem! Hope is useful!

Elektron97 gravatar image Elektron97  ( 2021-07-14 09:33:27 -0600 )edit

Please, answer me! I don't know how to fix this

Elektron97 gravatar image Elektron97  ( 2021-11-26 09:56:08 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-11-30 05:11:11 -0600

Elektron97 gravatar image

I found a solution in Github:

In catkin_ws/src:

git clone https://github.com/fizyr-forks/vision_opencv/tree/opencv4
cd vision_opencv
git checkout opencv4
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-07-12 08:38:31 -0600

Seen: 394 times

Last updated: Nov 30 '21