View images in rosbag2 bags with sqlite browser?

asked 2019-02-05 11:06:57 -0500

lucasw gravatar image

updated 2019-02-05 17:14:51 -0500

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? image description

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)

edit retag flag offensive close merge delete

Comments

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.

gvdhoorn gravatar imagegvdhoorn ( 2019-02-05 11:45:58 -0500 )edit
1

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)

Karsten gravatar imageKarsten ( 2019-02-05 14:15:51 -0500 )edit

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).

lucasw gravatar imagelucasw ( 2019-02-05 16:49:07 -0500 )edit

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.

gvdhoorn gravatar imagegvdhoorn ( 2019-02-06 02:48:22 -0500 )edit

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...

ruffsl gravatar imageruffsl ( 2019-02-13 23:10:11 -0500 )edit

Is there any rqt_bag alternative for visualizing/playing ROS 2 bags?

ubuntuslave gravatar imageubuntuslave ( 2019-06-19 12:11:07 -0500 )edit