ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

If you look at the definition of sensor_msgs/Image.msg you can see that the data type of the 'data' field is uint8[]. Python2 interpreters uint8[] as a string, so to use it as a list you have to convert it to a list or other data type that you want to use. To do the conversion you could for example use cv_bridge or do the conversion yourself.

If you print the whole class as in your first example, it actually uses the __repr__ and __str__ functions of the class to produce the readable output summarising the content of the class. This converts the uint8[] data to the readable list you see.