naver / dust3r

DUSt3R: Geometric 3D Vision Made Easy
https://dust3r.europe.naverlabs.com/
Other
4.66k stars 517 forks source link

can I fix the camera pose? Or given some restrictive priors #30

Closed kuaiqushangzixiba closed 3 months ago

kuaiqushangzixiba commented 3 months ago

A very good job! I have a fixed use of the scene, 4 cameras fixed to shoot an object, but I find that each time the output camera is not in the same position, can you give some prior conditions or modify the code to fix the camera pose?

vincent-leroy commented 3 months ago

Hello @kuaiqushangzixiba If you know the camera poses in advance, you can set them with the following: https://github.com/naver/dust3r/blob/517a4301745c650730f65482fb6de9889c0b2db9/dust3r/cloud_opt/optimizer.py#L66 The same can be done with focals and principal points https://github.com/naver/dust3r/blob/517a4301745c650730f65482fb6de9889c0b2db9/dust3r/cloud_opt/optimizer.py#L82 https://github.com/naver/dust3r/blob/517a4301745c650730f65482fb6de9889c0b2db9/dust3r/cloud_opt/optimizer.py#L91

Note that if you only care about having all reconstructions living in the same reference frame, you can get the output camera poses and parameters after processing the first sequence and set them manually for the rest of the reconstructions. Note that setting inaccurate camera poses might hinder the quality of the output in some cases.

Best

kuaiqushangzixiba commented 3 months ago

https://github.com/naver/dust3r/blob/517a4301745c650730f65482fb6de9889c0b2db9/demo.py#L91 return _convert_scene_output_to_glb(outdir, rgbimg, pts3d, msk, focals, cams2world, as_pointcloud=as_pointcloud, transparent_cams=transparent_cams, cam_size=cam_size)

Thanks a lot! When should I set it up? When you initialize global_aligner, or after get_3D_model_from_scene...

kuaiqushangzixiba commented 3 months ago

And when I set preset_pose(), I got the following error, I found that the declaration of this method was not defined in the code

AttributeError: 'PointCloudOptimizer' object has no attribute '_get_msk_indices'