matlab保存DB4i深度相机图片
bag = rosbag(fullfile('D:\','2022-06-22-16-54-08.bag'));
bSel_depth = select(bag,'Topic','/camera/color/image_raw');
depth_message=select(bSel_depth,'MessageType','sensor_msgs/Image');
data_depth=readMessages(depth_message);
L = length(data_depth);
for i=1:L
single_image = data_depth{i,1};
single_image_matlab =readImage(single_image);
figure(i);
imshow(single_image_matlab,[],'Border','tight'); % 'Border','tight'用来去除边缘
image_name = [num2str(i-1,'%04d'),'.jpg'];
saveas(i,fullfile('D:\bbbimage',image_name));
pause(0.2);
close(i);
end
参考:https://blog.csdn.net/hanmoge/article/details/123077809