Ask Your Question
0

How to understand data from the image_raw/compressed topic?

asked 2017-11-20 10:27:21 -0500

jmva gravatar image

updated 2017-11-20 13:29:00 -0500

jayess gravatar image

I wanted to know what they represent and how to read data from the image_raw / compressed topic. For example, the laser / scan topic, your "ranges" data represent the distance to an object, so the image_raw / compressed topic represents exactly what? How can I use them?

Here is an example of the topic:

header:
    seq: 2068
    stamp: 
    secs: 689
    nsecs: 786000000
  frame_id: camera_link
   format: rgb8; jpeg compressed bgr8

data: [255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 255, 219, 0, 67, 0, 6, 4, 5, 6, 5, 4, 6, 6, 5, 6, 7, 7, 6, 8, 10, 16, 10, 10, 9, 9, 10, 20, 14, 15, 12, 16, 23, 20, 24, 24, 23, 20, 22, 22, 26, 29, 37, 31, 26, 27, 35, 28, 22, 22, 32, 44, 32, 35, 38, 39, 41, 42, 41, 25, 31, 45, 48, 45, 40, 48, 37, 40, 41, 40, 255, 219, 0, 67, 1, 7, 7, 7, 10, 8, 10, 19, 10, 10, 19, 40, 26, 22, 26, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 255, 192, 0, 17, 8, 3, 32, 3, 32, 3, 1, 34, 0, 2, 17, 1, 3, 17, 1, 255, 196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 196, 0, 181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185...
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-11-21 04:26:24 -0500

For a compressed image, the byte stream in the data array is the jpeg compressed representation of the image. To use it with OpenCV, this jpeg representation first has to be decompressed to a uncompressed representation. Luckily, this is made transparent by the image_transport mechanism, so this is taken care of for you if you use that. Have a look at compressed_image_transport.

edit flag offensive delete link more

Comments

Thank you Stefan, I'll try this. I think it works for me.

jmva gravatar image jmva  ( 2017-11-21 07:21:07 -0500 )edit
0

answered 2017-11-20 13:04:33 -0500

robo_lady gravatar image

This topic is probably of type sensor_msgs/Image. You could use Rqt image view to look at the images being published to this topic.

Another option is to actually convert the ROS Messages to an OpenCV image. To interface ROS with openCV you need the cv_bridge package. This can be found on the ROS Wiki.

edit flag offensive delete link more

Comments

I've already looked at the image by RQT, I was wondering if there is any way to handle this data, without using rqt. For example, identify the xyz of objects in the gazebo using this data.

jmva gravatar image jmva  ( 2017-11-20 14:24:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-11-20 10:27:21 -0500

Seen: 1,600 times

Last updated: Nov 21 '17