Skip to content
Salvo Virga edited this page Sep 22, 2018 · 4 revisions

simple_msgs - Image

A simple_msgs::Image represent a 2D or 3D image/volume. It contains the following fields:

  • a simple_msgs::Pose: so that the image can be located in a 3D space [origin].
  • a simple_msgs::Header: so that the image location refers to a reference frame and it is stamped [header].
  • a string defining the image encoding [encoding].
  • the pixel spacing, defined as 3 doubles [spacing_x, spacing_y, spacing_z].
  • the image dimensions, defined as 3 int32s [widht, height, depth].
  • the size in bytes of the image data as int64 [image_data].
  • the number of channels of the image as int16 [num_channels].
  • the image data itself [data].

❗ The image data is templated, such that it can be uint8, int16 (short), float or double.

Examples

We provide an example that shows how to send/receive simple_msgs::Image using OpenCV to read the images to send and to show them after receiving them:

Image Publisher
Image Subscriber

You can turn on the appropriate CMake flag to also build this examples, that requires OpenCV to be installed on your system.

Clone this wiki locally