$ sudo apt-get install ros-melodic-opencv*
$ sudo apt-get install ros-melodic-cv-bridge
http://wiki.ros.org/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages
cmake_minimum_required(VERSION 3.0.2)
project(withCarla)
find_package(catkin REQUIRED COMPONENTS # catkin 변수에 components 패키지들이 추가됨.
roscpp # 즉 catkin_INCLUDE_DIRS에 catkin 뿐만 아니라 components로 추가된 패키지 경로까지 한번에 저장됨 => 관리가 쉬워짐
rospy
cv_bridge
std_msgs
sensor_msgs
image_transport
)
find_package(OpenCV REQUIRED) # 단, opencv 같이 런타임에 실행되는 패키지는 components로 쓸 수 없음 => OpenCV_INCLUDE_DIRS에 경로 저장됨
catkin_package( # 패키지의 정보를 다른 패키지들에 export 하기 위한 용도로 사용
# INCLUDE_DIRS include : 생성된 헤더 파일들이 위치하는 디렉토리
# LIBRARIES $ {PROJECT_NAME} : 프로젝트에 해당되는 라이브러리들이 위치하는 디렉토리
# CATKIN_DEPENDS roscpp rospy cv_bridge std_msgs sensor_msgs image_transport : 프로젝트의 catkin 의존성 패키지들
# DEPENDS opencv : catkin에 포함되지 않은 의존성 패키지들
)
include_directories(
# include
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
<?xml version="1.0"?>
<package format="2">
<name>withCarla</name>
<version>0.0.0</version>
<description>The withCarla package</description>
<maintainer email="[email protected]">hihiroo</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend> <!-- catkin 의존성 패키지들 -->
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>cv_bridge</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>image_transport</build_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>cv_bridge</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<build_export_depend>sensor_msgs</build_export_depend>
<build_export_depend>image_transport</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>cv_bridge</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>image_transport</exec_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>\\