MCPcopy
hub / github.com/junshutang/Make-It-3D / extract_geometry

Function extract_geometry

nerf/utils.py:179–194  ·  view source on GitHub ↗
(bound_min, bound_max, resolution, threshold, query_func, use_sdf = False)

Source from the content-addressed store, hash-verified

177
178
179def extract_geometry(bound_min, bound_max, resolution, threshold, query_func, use_sdf = False):
180 #print('threshold: {}'.format(threshold))
181 u = extract_fields(bound_min, bound_max, resolution, query_func)
182 if use_sdf:
183 u = - 1.0 *u
184
185 #print(u.mean(), u.max(), u.min(), np.percentile(u, 50))
186
187 vertices, triangles = mcubes.marching_cubes(u, threshold)
188
189 b_max_np = bound_max.detach().cpu().numpy()
190 b_min_np = bound_min.detach().cpu().numpy()
191
192 vertices = vertices / (resolution - 1.0) * (b_max_np - b_min_np)[None, :] + b_min_np[None, :]
193
194 return vertices, triangles
195
196class Trainer(object):
197 def __init__(self,

Callers

nothing calls this directly

Calls 2

extract_fieldsFunction · 0.85
cpuMethod · 0.45

Tested by

no test coverage detected