June 2018
Beginner to intermediate
280 pages
6h 58m
English
The first section of the Python code is given in the following code fragment. It mainly involves importing rospy, sys, cv2, sensor_msgs, cv_bridge, and the numpy module. The sensor_msgs dependency imports the ROS data type of both image and camera information type. The cv_bridge module imports the CvBridge class for converting the ROS image data type to the OpenCV data type and vice versa:
import rospyimport sysimport cv2from sensor_msgs.msg import Image, CameraInfofrom cv_bridge import CvBridge, CvBridgeErrorfrom std_msgs.msg import Stringimport numpy as np
The following section of code is a class definition in Python that we will use to demonstrate CvBridge functions. The class is ...