0
$\begingroup$

Rosanswers logo

Hi All, I am unfamiliar with sending images from MATLAB to ROS. I am using MATLAB for the image processing algorithm then sending images back to ROS from the MATLAB master node. I am reading images from a rgbd PointCloud2 captured with my Intel RealSense camera. When I execute the readRGB and readXYZ commands they return MATLAB variables (image matricies) of data type double and single respectively. I am processing these and attemtping to send back to ROS. My first attempts have been sending via an RBG8 encoding by converting my processed matrices to data type uint8. This gave me a blank black image. However, when I read this image into MATLAB (getting a uint8 matrix) and convert to data type double I am able to see the image correctly. I have tried uint16 as well.

How should I be sending these images from MATLAB so that they are viewable in Rviz? I would like to send them as a double but I don't seem to see any way to do that.

Thank you for your help!!


Originally posted by cmfuhrman on ROS Answers with karma: 200 on 2018-05-17

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I think I have solved the problem! (If it was a snake it would have bit me). Following this link I was able to encode with 64fc3 and 32fc3 for an image containing data of type double or single respectively.


Originally posted by cmfuhrman with karma: 200 on 2018-05-17

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by gvdhoorn on 2018-05-17:
For future reference: if you post an answer to your own question, please accept your own answer by clicking the checkmark to the left of your answer. That way it's clear the question has been answered.

Comment by cmfuhrman on 2018-05-17:
Upon further investigation I am unsure that this will work! Rviz states that this is an unsupported data type.

Comment by gvdhoorn on 2018-05-17:
RViz may not like it, but if it's a valid encoding for sensor_msgs/Image it's a good answer. It'll just mean you can't visualise it with the default tools, but cv_bridge and friends should still be able to deal with it.

If it's not a valid encoding, then that would be a different matter.

$\endgroup$

Your Answer

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