forked from Anttwo/SuGaR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract_mesh.py
47 lines (37 loc) · 2.51 KB
/
extract_mesh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import argparse
from sugar_utils.general_utils import str2bool
from sugar_extractors.coarse_mesh import extract_mesh_from_coarse_sugar
if __name__ == "__main__":
# Parser
parser = argparse.ArgumentParser(description='Script to extract a mesh from a coarse SuGaR scene.')
parser.add_argument('-s', '--scene_path',
type=str,
help='path to the scene data to use.')
parser.add_argument('-c', '--checkpoint_path',
type=str,
help='path to the vanilla 3D Gaussian Splatting Checkpoint to load.')
parser.add_argument('-i', '--iteration_to_load',
type=int, default=7000,
help='iteration to load.')
parser.add_argument('-m', '--coarse_model_path', type=str, default=None, help='')
parser.add_argument('-l', '--surface_level', type=float, default=None,
help='Surface level to extract the mesh at. If None, will extract levels 0.1, 0.3 and 0.5')
parser.add_argument('-d', '--decimation_target', type=int, default=None,
help='Target number of vertices to decimate the mesh to. If None, will decimate to 200_000 and 1_000_000.')
parser.add_argument('-o', '--mesh_output_dir',
type=str, default=None,
help='path to the output directory.')
parser.add_argument('-b', '--bboxmin', type=str, default=None, help='Min coordinates to use for foreground.')
parser.add_argument('-B', '--bboxmax', type=str, default=None, help='Max coordinates to use for foreground.')
parser.add_argument('--center_bbox', type=str2bool, default=False, help='If True, center the bounding box. Default is False.')
parser.add_argument('--gpu', type=int, default=0, help='Index of GPU device to use.')
parser.add_argument('--eval', type=str2bool, default=True, help='Use eval split.')
parser.add_argument('--use_centers_to_extract_mesh', type=str2bool, default=False,
help='If True, just use centers of the gaussians to extract mesh.')
parser.add_argument('--use_marching_cubes', type=str2bool, default=False,
help='If True, use marching cubes to extract mesh.')
parser.add_argument('--use_vanilla_3dgs', type=str2bool, default=False,
help='If True, use vanilla 3DGS to extract mesh.')
args = parser.parse_args()
# Call function
extract_mesh_from_coarse_sugar(args)