ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

MATLAB send ROS Image as Double Data Type

asked 2018-05-17 11:37:24 -0500

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!!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-05-17 11:45:54 -0500

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.

edit flag offensive delete link more

Comments

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.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-17 11:54:08 -0500 )edit

Upon further investigation I am unsure that this will work! Rviz states that this is an unsupported data type.

cmfuhrman gravatar image cmfuhrman  ( 2018-05-17 11:55:36 -0500 )edit
1

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.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-17 11:58:06 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-05-17 11:37:24 -0500

Seen: 259 times

Last updated: May 17 '18