Skip to Content
Learning Robotics using Python - Second Edition
book

Learning Robotics using Python - Second Edition

by Lentin Joseph
June 2018
Beginner to intermediate
280 pages
6h 58m
English
Packt Publishing
Content preview from Learning Robotics using Python - Second Edition

Displaying Kinect images using Python, ROS, and cv_bridge

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Robotics using Python

Learning Robotics using Python

Lentin Joseph
Python Robotics Projects

Python Robotics Projects

Prof. Diwakar Vaish

Publisher Resources

ISBN: 9781788623315Supplemental Content