I cannot figure out what is the exact format of the sensor_msg Image() file. When I issue the command:
rostopic echo /camera/image_raw
I get a massive output consisting of thousands of numbers in an array. However, when I look up the documentation, there is supposed to be a heading, height, width, etc and the actual data. I have never been able to find the header or any other parameter from the output. I also cannot figure out just how large the file is. This makes it difficult to manipulate and transport the data. Can someone please help me out?
Originally posted by Tejas Rao on ROS Answers with karma: 3 on 2021-08-24
Post score: 0
Original comments
Comment by gvdhoorn on 2021-08-24:
The rostopic --help
output may offer some guidance here:
--nostr exclude string fields
--noarr exclude arrays
if you add --noarr
to your rostopic echo
command, you'll be able to see the header and other non-array fields.
there is supposed to be a heading
probably a typo, but there is a header
field. Not heading
.
This makes it difficult to manipulate and transport the data.
A general usability suggestion: if you can accept the OpenCV dependency, try to consume sensor_msgs/Image
messages using image_transport subscribers and convert messages to their OpenCV representation. That will make it much easier to work with them.
Working directly with the serialised form (in the form of sensor_msgs/Image
) might not be the most efficient (from a usability perspective).