MCPcopy Index your code
hub / github.com/apple/ml-pointersect / render_mesh

Function render_mesh

pointersect/inference/main.py:129–448  ·  view source on GitHub ↗

Given a mesh file (as ground truth), 1) sample point cloud using RGBD cameras, or directly sample from mesh 2) render the point cloud from different viewpoints (using different methods) 3) compute errors (surface normal, point to mesh, image error, silhouette error, etc) Args:

(
        mesh_filename: str,
        output_dir: str,
        model_filename: T.Union[str, T.List[str]],
        # for input/output camera
        input_point_sample_method: str,  # 'rgbd', 'poisson_disk'
        n_input_imgs: int,
        n_output_imgs: int,
        input_camera_trajectory_mode: str,
        output_camera_trajectory_mode: str,
        # for pointersect
        k: int,
        # for comparison with baselines
        render_pointersect: bool = True,
        render_npbgpp: bool = False,
        render_surfel: bool = True,
        render_nglod: bool = False,
        render_ngp: bool = False,
        render_dsnerf: bool = False,
        render_ibrnet: bool = False,
        render_poisson: bool = True,
        densify_neural_points: bool = False,
        # other settings
        mesh_scale: float = 1.0,
        rnd_seed: int = 0,
        input_camera_trajectory_params: T.Dict[str, T.Any] = None,
        output_camera_trajectory_params: T.Dict[str, T.Any] = None,
        input_camera_setting: T.Dict[str, T.Any] = None,
        output_camera_setting: T.Dict[str, T.Any] = None,
        save_settings: T.Dict[str, T.Any] = None,
        pr_setting: T.Dict[str, T.Any] = None,
        model_loading_settings: T.Dict[str, T.Any] = None,
        max_ray_chunk_size: int = int(1e4),  # k=40: int(4e4),
        max_pr_chunk_size: int = -1,
        max_model_chunk_size: int = -1,
        th_hit_prob: float = 0.5,
        n_input_points: int = 9728,
        force_same_intrinsic: bool = False,
        voxel_downsample_cell_width: float = -1,
        voxel_downsample_sigma: float = 0.5,
        neural_point_upsample_ratio_x48: int = 1,
        total_nglod_epoch: int = 50,
        nglod_test_every_iter: int = 50,
        total_ngp_epoch: int = 50,
        ngp_test_every_iter: int = 50,
        total_dsnerf_iter: int = 50000,
        dsnerf_test_every_iter: int = 5000,
        test_plane_normal: bool = False,
        drop_point_cloud_features: bool = False,
        drop_point_cloud_normal: bool = False,
        ibrnet_chunk_size: int = 4096,
        surfel_point_size: float = 1.,
        **kwargs,
)

Source from the content-addressed store, hash-verified

127
128
129def render_mesh(
130 mesh_filename: str,
131 output_dir: str,
132 model_filename: T.Union[str, T.List[str]],
133 # for input/output camera
134 input_point_sample_method: str, # 'rgbd', 'poisson_disk'
135 n_input_imgs: int,
136 n_output_imgs: int,
137 input_camera_trajectory_mode: str,
138 output_camera_trajectory_mode: str,
139 # for pointersect
140 k: int,
141 # for comparison with baselines
142 render_pointersect: bool = True,
143 render_npbgpp: bool = False,
144 render_surfel: bool = True,
145 render_nglod: bool = False,
146 render_ngp: bool = False,
147 render_dsnerf: bool = False,
148 render_ibrnet: bool = False,
149 render_poisson: bool = True,
150 densify_neural_points: bool = False,
151 # other settings
152 mesh_scale: float = 1.0,
153 rnd_seed: int = 0,
154 input_camera_trajectory_params: T.Dict[str, T.Any] = None,
155 output_camera_trajectory_params: T.Dict[str, T.Any] = None,
156 input_camera_setting: T.Dict[str, T.Any] = None,
157 output_camera_setting: T.Dict[str, T.Any] = None,
158 save_settings: T.Dict[str, T.Any] = None,
159 pr_setting: T.Dict[str, T.Any] = None,
160 model_loading_settings: T.Dict[str, T.Any] = None,
161 max_ray_chunk_size: int = int(1e4), # k=40: int(4e4),
162 max_pr_chunk_size: int = -1,
163 max_model_chunk_size: int = -1,
164 th_hit_prob: float = 0.5,
165 n_input_points: int = 9728,
166 force_same_intrinsic: bool = False,
167 voxel_downsample_cell_width: float = -1,
168 voxel_downsample_sigma: float = 0.5,
169 neural_point_upsample_ratio_x48: int = 1,
170 total_nglod_epoch: int = 50,
171 nglod_test_every_iter: int = 50,
172 total_ngp_epoch: int = 50,
173 ngp_test_every_iter: int = 50,
174 total_dsnerf_iter: int = 50000,
175 dsnerf_test_every_iter: int = 5000,
176 test_plane_normal: bool = False,
177 drop_point_cloud_features: bool = False,
178 drop_point_cloud_normal: bool = False,
179 ibrnet_chunk_size: int = 4096,
180 surfel_point_size: float = 1.,
181 **kwargs,
182):
183 """
184 Given a mesh file (as ground truth),
185 1) sample point cloud using RGBD cameras, or directly sample from mesh
186 2) render the point cloud from different viewpoints (using different methods)

Callers 2

batch_render_meshFunction · 0.85
launchFunction · 0.85

Calls 12

get_cameraMethod · 0.95
get_rgbd_imageMethod · 0.95
sample_point_cloudMethod · 0.95
MeshClass · 0.90
CameraTrajectoryClass · 0.90
get_settingsFunction · 0.85
main_renderFunction · 0.85
deviceMethod · 0.80
get_pcdMethod · 0.80
voxel_downsamplingMethod · 0.80
drop_featuresMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected