How to use sensor_msgs.msg.Image data to train a NN
I'm trying to do some RL for driving a vehicle using the CARLA simulator. I'm using the carla-ros-bridge that's made available by the CARLA team. In order to get camera image data, I need to read the data from the topic /carla/ego_vehicle/camera/rgb/front/image_color. I'm able to subscribe to this topic and see the data when I display the class, but I am unable to extract the data from the class. By using this code:
def camera_callback(data):
print('CAMERA')
rospy.loginfo(data)
time.sleep(2)
rospy.Subscriber('carla/ego_vehicle/camera/rgb/front/image_color', Image, camera_callback)
I am able to see the image data as a list of numbers, but once I try to extract the data (data.data) like this:
def camera_callback(data):
print('CAMERA')
rospy.loginfo(data.data)
time.sleep(2)
rospy.Subscriber('carla/ego_vehicle/camera/rgb/front/image_color', Image, camera_callback)
It spits out what looks like it's reading a binary file and I'm unable to view the list of numbers. How can I extract the data and view the list so I can use the data?
For readability could you use the formatting settings to properly format the code?