[ros-users] How to encode mono16 data in Image messages?

Patrick Mihelich mihelich at willowgarage.com
Tue Jun 1 22:49:34 UTC 2010


Hi Jack,

MONO16 is the correct encoding to use. We've done practically no testing
with 16-bit encodings, so I'm not surprised that there are problems. I see
nothing wrong with your code snippet.

The image_view error is either a bug in cv_bridge or deeper down in OpenCV.
Can you open a ticket <https://code.ros.org/trac/ros-pkg/newticket> against
vision_opencv?

Patrick

On Mon, May 31, 2010 at 10:04 AM, Jack O'Quin <jack.oquin at gmail.com> wrote:

> I am trying to get the "*_mono16" video modes working with camera1394.
> If I just copy the two-byte pixels, image_view of camera_raw fails
> with an opencv exception. I can't tell if this is a bug in the camera
> driver or in image_view.
>
> I've looked at docs and code, but I'm still not clear how 16-bit
> monochrome image data should be encoded. The two-byte per pixel copy
> is modeled on cameradc1394. Is this snippet of code wrong?
>
>    case DC1394_VIDEO_MODE_640x480_MONO16:
>    case DC1394_VIDEO_MODE_800x600_MONO16:
>    case DC1394_VIDEO_MODE_1024x768_MONO16:
>    case DC1394_VIDEO_MODE_1280x960_MONO16:
>      if (!DoBayerConversion_)
>        {
>          image.step=image.width*2;
>          image_size = image.height*image.step;
>          image.encoding = enc::MONO16;
>          image.data.resize(image_size);
>          memcpy(&image.data[0], capture_buffer, image_size);
>        }
>
> Could this be a little-endian problem?
> --
>  joq
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100601/ed62b365/attachment-0002.html>


More information about the ros-users mailing list