extract 3D_model (glb file) from a reconstructed scene
(outdir, silent, scene, min_conf_thr=3, as_pointcloud=False, mask_sky=False,
clean_depth=False, transparent_cams=False, cam_size=0.05)
| 108 | |
| 109 | |
| 110 | def get_3D_model_from_scene(outdir, silent, scene, min_conf_thr=3, as_pointcloud=False, mask_sky=False, |
| 111 | clean_depth=False, transparent_cams=False, cam_size=0.05): |
| 112 | """ |
| 113 | extract 3D_model (glb file) from a reconstructed scene |
| 114 | """ |
| 115 | if scene is None: |
| 116 | return None |
| 117 | # post processes |
| 118 | if clean_depth: |
| 119 | scene = scene.clean_pointcloud() |
| 120 | if mask_sky: |
| 121 | scene = scene.mask_sky() |
| 122 | |
| 123 | # get optimized values from scene |
| 124 | rgbimg = scene.imgs |
| 125 | focals = scene.get_focals().cpu() |
| 126 | cams2world = scene.get_im_poses().cpu() |
| 127 | # 3D pointcloud from depthmap, poses and intrinsics |
| 128 | pts3d = to_numpy(scene.get_pts3d()) |
| 129 | scene.min_conf_thr = float(scene.conf_trf(torch.tensor(min_conf_thr))) |
| 130 | msk = to_numpy(scene.get_masks()) |
| 131 | return _convert_scene_output_to_glb(outdir, rgbimg, pts3d, msk, focals, cams2world, as_pointcloud=as_pointcloud, |
| 132 | transparent_cams=transparent_cams, cam_size=cam_size, silent=silent) |
| 133 | |
| 134 | |
| 135 | def get_reconstructed_scene(outdir, model, device, silent, image_size, filelist, schedule, niter, min_conf_thr, |
no test coverage detected