lukasvst / dm-vio

Source code for the paper DM-VIO: Delayed Marginalization Visual-Inertial Odometry
GNU General Public License v3.0
1.05k stars 184 forks source link

How to saveout the result as pointcloud? #34

Open Secret-Lin opened 1 year ago

Secret-Lin commented 1 year ago

Thx for the last issue. I sucessfully run the code. As title! Or can I get the location of the 3D points in any format?

lukasvst commented 1 year ago

At the moment the pointclouds are not saved so you would have to implement this yourself. For this you can create your own Output3DWrapper https://github.com/lukasvst/dm-vio/blob/master/src/dso/IOWrapper/Output3DWrapper.h#L199 and override publishKeyframes see https://github.com/lukasvst/dm-vio/blob/master/src/dso/IOWrapper/OutputWrapper/SampleOutputWrapper.h#L77 as an example. You then need to register the Output3DWrapper to the fullSystem (like this https://github.com/lukasvst/dm-vio/blob/master/src/main_dmvio_dataset.cpp#L143)

The pointcloud is passed to publishKeyframes as position in the image (u, v) and inverse depth, so to get the 3D-XYZ coordinate you will need to reproject it to 3D. Here you can find an example of how to do this: https://github.com/lukasvst/dm-vio/blob/master/src/dso/IOWrapper/Pangolin/KeyFrameDisplay.cpp#L240-L263