cvg / Hierarchical-Localization

Visual localization made easy with hloc
Apache License 2.0
3.24k stars 600 forks source link

How to display 3D-Model of aachen like demo.ipynb #328

Open Ma-yiwei opened 1 year ago

Ma-yiwei commented 1 year ago

Thank you for your amazing job, and when I use these command: fig = viz_3d.init_figure() viz_3d.plot_reconstruction(fig, reconstruction, color='rgba(255,0,0,0.5)', name="mapping", points_rgb=True) fig.show() the ipynb file just shut down, how can I display the reconstructed 3D model and the estimated camera pose in the 3D map.

ArneSchulzTUBS commented 1 year ago

For rather large models plotly tends to crash within an ipynb. You can try writing the model to disk and viewing it with a browser. (Chrome has worked best for me)

fig = viz_3d.init_figure()
viz_3d.plot_reconstruction(fig, reconstruction, color='rgba(255,0,0,0.5)', name="mapping", points_rgb=True)
fig.write_html("sfm_output.html")
Adolfhill commented 11 months ago

@ArneSchulzTUBS hello, thanks for your help. I use this code to display 3D-Model of aachen: ` model = pycolmap.Reconstruction("outputs/aachen/sfm_sift")

print(model.summary())

fig = viz_3d.init_figure() viz_3d.plot_reconstruction(fig, model, color='rgb(0, 0, 255)', name="mapping", points_rgb=True) fig.write_html("sfm_output.html") ` the code generate a 67MB html. But when I try to open it in chrome, there is nothing in the web. Could you please help me fix that?

ArneSchulzTUBS commented 11 months ago

@Adolfhill

Above a certain point limit, the plotly renderer fails because it is not designed for rendering large point clouds containing several million elements.

If you just want to examine the reconstructed model you can use COLMAP's GUI as hloc uses the same format due to the use of pycolmap as SFM-Backend. Note that you need to install the standalone version of COLMAP first https://colmap.github.io/install.html

grafik

If you want to debug localization tasks there is no easy way to my knowledge. You can take inspiration from the visualization approaches implemented by LaMAR utilizing meshlab. https://github.com/microsoft/lamar-benchmark/tree/main

Adolfhill commented 11 months ago

@ArneSchulzTUBS thanks for your help.