Ask Your Question
0

How to change OpenCV version of any ros package?

asked 2020-03-09 04:51:50 -0500

jahim44229 gravatar image

updated 2020-03-09 04:53:45 -0500

Example ;

find_package(RTABMap 0.19.5 REQUIRED)

find_package(OpenCV 4.2.0 REQUIRED)

find_package(PCL 1.7 REQUIRED)
add_definitions(${PCL_DEFINITIONS}) # To include -march=native if set

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES rtabmap_ros
  CATKIN_DEPENDS cv_bridge roscpp rospy sensor_msgs std_msgs std_srvs nav_msgs geometry_msgs visualization_msgs
                 image_transport tf tf_conversions tf2_ros eigen_conversions laser_geometry pcl_conversions 
                 pcl_ros nodelet dynamic_reconfigure message_filters class_loader rosgraph_msgs
                 stereo_msgs move_base_msgs image_geometry ${optional_dependencies}
  DEPENDS RTABMap OpenCV
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}/include
  ${RTABMap_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
  ${PCL_INCLUDE_DIRS}
  ${catkin_INCLUDE_DIRS}
)

# libraries
SET(Libraries
   ${OpenCV_LIBRARIES}
   ${PCL_LIBRARIES}
   ${catkin_LIBRARIES}
   ${RTABMap_LIBRARIES}
)

It works like this when compiled.

I just changed the find_package () section.

Is it necessary to make changes in other parts? For Example in catkin_package ().

catkin_package ( DEPENDS RTABMap OpenCV )

to

catkin_package ( DEPENDS RTABMap OpenCV 4.2.0 )

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-03-09 09:57:01 -0500

pavel92 gravatar image

updated 2020-03-09 09:57:30 -0500

find_package(OpenCV 4.2.0 REQUIRED) is enough. You dont need to specify the version later on I think.
Check the following question. It gives a good explanation on how to use CMake macros.

Also dont forget to link the libraries:

target_link_libraries(your_executable
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-03-09 04:51:50 -0500

Seen: 331 times

Last updated: Mar 09 '20