Compressed camera images from rosbag to matlab
I have a bag file containing lots of sensor messages, including compressed camera images. I would like to use this stream of camera images in MATLAB.
I know of two possible approaches: either by exporting all images to JPG and load those into MATLAB, or by using ROSMATLAB.
I think that the first approach would involve creating a Python script to collect the camera images form the image_transport
node republish
. This seems to involve an awful lot of decompressing and compressing (when saving back to JPG), so I'm looking for a way to directly collect the images from the bag file and save those. I believe that the compressed images in the bag file are JPG compressed, so it should be possible to directly map them.
The second approach would also involve the republish
node, I think, since ROSMATLAB does not yet seem to support image transport. Also, I've run into problems collecting the images on the subscriber. I've seen this great tutorial on creating an image publisher, but I found it hard to reverse it. I've also seen this question on ROS answers, which does a good job showing some of the basics, but I couldn't replicate it.
Long story short: can anyone provide a best practice to manage images from a rosbag in MATLAB?