0
$\begingroup$

Rosanswers logo

Hi there !

I generate a 16bits image (stored in an opencv CV_16U) that I convert to a msg using cv_bridge with the right encoding (mono16). When I do a rostopic echo on the image topic, I get this kind of output :

header: seq: 481 stamp: secs: 1456138732 nsecs: 716579801 frame_id: '' height: 250 width: 1 encoding: mono16 is_bigendian: 0 step: 2 data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 7, 0, 7, 0, 9, 0, 9, 0, 7, 0, 9, 0, 7, 0, 9, 0, 9, 0, 9, 0, 7, 0, 11, 0, 7, 0, 9, 0, 11, 0, 9, 0, 9, 0, 9, 0, 13, 0, 9, 0, 11, 0, 11, 0, 9, 0, 11, 0, 11, 0, 11, 0, 13, 0, 11, 0, 11, 0, 13, 0, 11, 0, 13, 0, 13, 0, 13, 0, 11, 0, 13, 0, 14, 0, 13, 0, 13, 0, 14, 0, 14, 0, 13, 0, 16, 0, 14, 0, 14, 0, 16, 0, 14, 0, 16, 0, 14, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

so the image appears as mono16 but the values displayed never go over 255 and there are 0 appearing between values that I can see are wrong. So looking at this, it looks like it's displaying the image as an 8bit image instead of 16bits image. I can then read the image in my node and the data looks fine so it's just a display issue really.

I haven't thing any mention of this in any answer here so I suspect it's a bug, am I the only one to observe this ?

Configuration : Ubuntu 14.04 LTS - ros-indigo full-desktop

Thanks


Originally posted by Thomas Guerneve on ROS Answers with karma: 11 on 2016-02-22

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This is just the encoding of the image data as a byte array. I would assume you'll find twice the byte entries here than you have image pixels. You just have to interpret two bytes as a 16-bit pixel.


Originally posted by dornhege with karma: 31395 on 2016-02-22

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Thomas Guerneve on 2016-02-24:
Absolutely, as I said I can read the image and use it without any issue, but it should be displayed properly in rostopic echo, it's handy for debugging...

Comment by dornhege on 2016-02-24:
It is displayed correctly in rostopic - in the sense that rostopic shows you, what exactly is send as the message. What you are looking for is a semantic interpretation of messages. rostopic cannot do that as it would need to know how to interpret any message. It's also the tool to show raw data.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.