Save bagile with regular images to bagile with compressed images
I have a bagfile with images saved on it. I would like to create a new bagfile with the images saved as compressed images, is that possible once the data has been already recorded?
If yes, what would the best approach to do it?
Thanks!
I don't know about the "best" approach, but I think a reasonable way to do it is to create a script that runs through the bag file and if not the image topic you want to change, record. If it is, run your compression algorithm and then store the compressed messages. ROSBag has a good API to read a bag file and add new stuff to a new bag file.
An aside which I don't know is helpful: rosbag also lets you create compressed rosbags if you're just looking to compress the entire bag file size. May be helpful depending on your objective.