MCPcopy Create free account
hub / github.com/OpenMeshLab/MeshXL / random_sampling

Function random_sampling

utils/pc_util.py:24–32  ·  view source on GitHub ↗

Input is NxC, output is num_samplexC

(pc, num_sample, replace=None, return_choices=False)

Source from the content-addressed store, hash-verified

22
23
24def random_sampling(pc, num_sample, replace=None, return_choices=False):
25 """Input is NxC, output is num_samplexC"""
26 if replace is None:
27 replace = pc.shape[0] < num_sample
28 choices = np.random.choice(pc.shape[0], num_sample, replace=replace)
29 if return_choices:
30 return pc[choices], choices
31 else:
32 return pc[choices]
33
34
35# ----------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected