Getting image data from DepthImageProto


I am trying to parse out the image data (pixels) from the ImageProto in DepthCameraProto. I see from reading through code that there is some way of converting an ImageProto to an image view but this is very unclear. Does anyone know how to get at the pixel data from an ImageProto? Particularly the depth data fron the ImageProto in the DepthCameraProto?

Thank you in advance!


It seems we are missing this vital information in our documentation, thanks for bringing it up.

I’ll prepare a more complete sample, but assuming you have

ISAAC_PROTO_RX(ColorCameraProto, color_listener);

in your header file, here is how you would read a color image:

#include "engine/gems/image/color.hpp"
#include "engine/gems/image/io.hpp"
#include "engine/gems/image/utils.hpp"
#include "messages/camera.hpp"

// ....
ImageConstView3ub color_image;
FromProto(rx_color_listener().getProto().getImage(), rx_color_listener().buffers(), color_image);
SavePng(color_image, "path_to_file.png");

For depth, please use DepthCameraProto instead of ColorCameraProto and ImageConstView1f instead of ImageConstView3ub.

I’ll prepare a complete sample soon and update the documentation for our next release. Thanks again.


I encountered the same problem,but what we want is the data in buffers rather than the image

file.Can you provide a method to get the buffers data in ColorCameraProto?

I try to get the data in this way,auto databuff=rx_color_listener().buffers(); what the type of the



ImageConstView3ub class and FromProto() function provides an easy way to parse the data from ColorCameraProto. If you need to access the buffer, you can do so using the data() member function of ImageConstView3ub. Please see engine/core/image/image.hpp for details. Also FromProto() in messages/image.hpp shows how to read buffers from ImageProto.

Please see apps/tutorials/opencv_edge_detection/EdgeDetector.{cpp,hpp}, where we have
ISAAC_PROTO_RX(ColorCameraProto, input_image);
ISAAC_PROTO_TX(ColorCameraProto, output_image);

I am still confused about how to get the buffer data of ColorCameraProto. I used the data() member function, and then? How can I print the data to the screen for example? I haven’t found the realize of the data() function.

Thank you in advance!

Can you please post some code snippets describing what you are trying to accomplish. The SDK provides several viewer nodes that can be used to view data in Sight and if you have an ImageView after using the FromProto function you should have the ability to manipulate the data.

Without a deeper understanding of what you’re trying to accomplish, we cannot provide additional insight.