eliphatfs commited on
Commit
c3cc2f4
·
1 Parent(s): 7a4df11

Resampling point cloud.

Browse files
Files changed (1) hide show
  1. openshape/demo/misc_utils.py +7 -0
openshape/demo/misc_utils.py CHANGED
@@ -128,6 +128,13 @@ def input_3d_shape():
128
  pc[:, :3] = pc[:, :3] / numpy.linalg.norm(pc[:, :3], axis=-1).max()
129
  if pc.shape[1] == 3:
130
  pc = numpy.concatenate([pc, numpy.ones_like(pc)], axis=-1)
 
 
 
 
 
 
 
131
  prog.progress(0.3, "Preprocessed Point Cloud")
132
  return pc.astype(f32)
133
 
 
128
  pc[:, :3] = pc[:, :3] / numpy.linalg.norm(pc[:, :3], axis=-1).max()
129
  if pc.shape[1] == 3:
130
  pc = numpy.concatenate([pc, numpy.ones_like(pc)], axis=-1)
131
+ prog.progress(0.27, "Normalized Point Cloud")
132
+ if pc.shape[0] > 10000:
133
+ pc = pc[numpy.random.permutation(len(pc))[:10000]]
134
+ elif pc.shape[0] == 0:
135
+ raise ValueError("Got empty point cloud!")
136
+ elif pc.shape[0] < 10000:
137
+ pc = numpy.concatenate([pc, pc[numpy.random.randint(len(pc), size=[10000 - len(pc)])]])
138
  prog.progress(0.3, "Preprocessed Point Cloud")
139
  return pc.astype(f32)
140