March 2018
Intermediate to advanced
1396 pages
42h 14m
English
ROS uses the standalone OpenCV library installed on your system. However, you must specify a build and run dependency with an opencv2 package in the package.xml file:
<build_depend>opencv2</build_depend> <run_depend>opencv2</run_depend>
In CMakeLists.xml, we have to insert the following lines:
find_package(OpenCV)
include_directories(${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
Then, for each library or executable that uses OpenCV, we must add ${OpenCV_LIBS} to target_link_libraries (see CMakeLists.txt provided for the chapter5_tutorials package).
In our node .cpp file, we include any of the OpenCV libraries we need. For example, for highgui.hpp, we use the following line:
#include <opencv2/highgui/highgui.hpp> ...