View images in rosbag2 bags with sqlite browser?
Is it possible to view the Images saved in a rosbag2 bag with a generic sqlite database browser like sqlitebrowser? Is that (or maybe any other message type) something that could be supported in the future with a plugin for the browser/viewer?
Update
Here i can see the image data, though if I set the mode to Image in the upper right Edit Database Cell widget it is blank- maybe there is a way to tell sqlitebrowser offset (as suggested below) width/height and anything else needed?
I can export the blob, but I don't think there are any tools to deal with it:
$ hexdump test.image -C |more
00000000 00 01 00 00 95 b7 59 5c 44 67 72 07 0b 00 00 00 |......Y\Dgr.....|
00000010 73 69 6d 5f 63 61 6d 65 72 61 00 00 00 04 00 00 |sim_camera......|
00000020 00 04 00 00 06 00 00 00 6d 6f 6e 6f 38 00 00 00 |........mono8...|
00000030 00 04 00 00 00 00 10 00 00 1b 09 0e 01 0a 01 01 |................|
00000040 09 16 09 01 02 02 08 03 13 06 00 04 07 1b 16 0f |................|
00000050 02 09 08 00 00 08 15 10 12 19 0f 01 0f 0f 08 07 |................|
00000060 0e 03 00 00 07 0e 0a 0d 0f 11 05 05 0a 02 0e 08 |................|
00000070 0b 01 07 08 05 08 13 01 07 08 00 09 08 0a 09 14 |................|
...
From the sqlitebrowser source:
QImage img;
...
case ImageViewer:
// Load the image into the image viewing widget
if (img.loadFromData(data)) {
ui->editorImage->setPixmap(QPixmap::fromImage(img));
}
https://github.com/sqlitebrowser/sqli...
It leans entirely on qt to display images, it does support a number of formats by default:
http://doc.qt.io/qt-5/qimage.html#rea...
"New file formats can be added as plugins"
So if support for sensor_msgs::Image was added as a QT plugin that was installed as a part of ros then sqlitebrowser and any number of other tools would be able to show them without recompiling? Ros qt applications including rqt_image_view displaying Images would be simplified in the process.
(TODO look at gimp support)
Unless "generic sqlite browsers" understand the image format(s) used in ROS 2 and/or ROS 2 message structures, I don't believe this will work without a plugin, as you note yourself.
We haven't tested it specifically for that use case but i also doubt that it's supported out of the box. if there's an sqlite viewer which is able to interpret a binary blob as a specific image type, you might have a chance to point to the data array of the message (basically by offsettting)
There is an image preview feature but I'm guessing it expects png or jpg. If there is stability to sensor_msgs::Image and format within a bag then it makes sense to push support for it into other image tools (with some minimalized
Image
dependency, not the whole of ros).Afaik the image preview expects raw / plain image data (ie: header + image bytes). The bag contains additional data, and even the msg fields do not conform to the expected format(s). A plugin / extension to the viewer is going to be necessary.
Perhaps you could write/import an SQLite extension to decode image messages and insert a separate column of the database in memory with a png in binary form for visualization. Could use that for laserscan previews as well. https://github.com/sqlitebrowser/sqli...
Is there any
rqt_bag
alternative for visualizing/playing ROS 2 bags?