How can I subscribe to Image topic on ROS Matlab and obtain the RGB image?

Technical Source
1 min readJun 7, 2023

Hello,

Please, how can I extract an image from a ROS Image Message followed by an imshow? I have already subscribed to the correct topic but message.getData() gives me a SlicedChannelBuffer object. Thanks,

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

ip="Your IP Address";
rosinit(ip);
%Command Velocity Publisher
robotCmd = rospublisher("/cmd_vel","DataFormat","struct") ;
velMsg = rosmessage(robotCmd);
%Camera Subscriber
img_sub = rossubscriber("/camera/rgb/image_raw","DataFormat","struct");
%Publish a constant angular velocity
velMsg.Angular.Z=0.5;
send(robotCmd,velMsg);
% Start timer
tic;
figure
while toc < 20
%Image
im = receive(img_sub);
image = rosReadImage(im);
imshow(image);

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.