ROS中的OpenCV

文章目录

  • ROS中的OpenCv
    • 在ROS中使用自带的OpenCV
      • 头文件如下:
      • CMakeLists.txt改动如下:

ROS中的OpenCv

ROS 在kinetic版本中自带了 OpenCV3,通过 ros-kinetic-opencv3安装。在目录 /opt/ros/kinetic/include/opencv-3.1.0-dev中。

在ROS中使用自带的OpenCV

头文件如下:

#include 
#include 
#include 

CMakeLists.txt改动如下:

set(OpenCV_DIR /opt/ros/kinetic/include/opencv-3.1.0-dev)
find_package(catkin REQUIRED COMPONENTS 
  roscpp
  OpenCV
)
include_directories(
 include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(testing
${catkin_LIBRARIES} 
${OpenCV_LIBRARIES}
)

CMakeLists.txt文件中如果没有`set(OpenCV_DIR /opt/ros/kinetic/include/opencv-3.1.0-dev)`,将会报错:
Could not find a package configuration file provided by "OpenCV" with any
  of the following names:

    OpenCVConfig.cmake
    opencv-config.cmake

你可能感兴趣的:(ROS,基础知识,OpenCv)