rtabmap icon indicating copy to clipboard operation
rtabmap copied to clipboard

How to extract raw stereo images(left and right camera images) from database created by Rtabmap.

Open skitmanish opened this issue 10 months ago • 4 comments

Could you please let me know if the RTAB-Map database has a specific field that stores the left and right camera images from the stereo setup? If so, what is the field name, and how can it be accessed?

Thanks!

skitmanish avatar Feb 10 '25 13:02 skitmanish

You can use rtabmap-databaseViewer and do File -> Extract images...

You can also use rtabmap-export --images rtabmap.db.

If you want to extract yourself from the database, they are compressed blob that can be decoded by opencv's imdecode function: https://github.com/introlab/rtabmap/blob/618e839999f5717f5269c6dff5e4868e6ad9d045/corelib/src/resources/DatabaseSchema.sql.in#L33-L34 (depth is the right image in a stereo config)

matlabbe avatar Feb 12 '25 05:02 matlabbe

Hi, thank you for the quick response!

I have another question:

I am running Rtabmap with local stereo images and want to store the exact same images I provided as input. I used the Data Recorder tool to store raw data, but I noticed that the right images in the exported database are grayscale and resized based on the provided decimation. I need the images to be stored in their original size and in color. Is there a way to achieve this?

skitmanish avatar Feb 12 '25 08:02 skitmanish

Don't provide decimation to keep same resolution. To keep the right image as rgb, you may have to hard-code the output encoding here to bgr8 instead of mono8: https://github.com/introlab/rtabmap_ros/blob/a57b2971f2079d375f867bdb6927efefd75ddd38/rtabmap_conversions/src/MsgConversion.cpp#L2494 However, I am not totally sure at 100% that it would not cause any issue.

matlabbe avatar Mar 01 '25 22:03 matlabbe

Added a PR to support right color image downstream: https://github.com/introlab/rtabmap/pull/1463

matlabbe avatar Mar 09 '25 00:03 matlabbe