0
$\begingroup$

Rosanswers logo

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?


Originally posted by Elektron97 on ROS Answers with karma: 11 on 2021-07-12

Post score: 0


Original comments

Comment by Elektron97 on 2021-07-14:
Add some new informations for my problem! Hope is useful!

Comment by Elektron97 on 2021-11-26:
Please, answer me! I don't know how to fix this

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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

Originally posted by Elektron97 with karma: 11 on 2021-11-30

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.