remove o3d voxel_downsample
This commit is contained in:
15
utils/pts.py
15
utils/pts.py
@@ -1,16 +1,14 @@
|
||||
import numpy as np
|
||||
import open3d as o3d
|
||||
import torch
|
||||
from scipy.spatial import cKDTree
|
||||
|
||||
class PtsUtil:
|
||||
|
||||
@staticmethod
|
||||
def voxel_downsample_point_cloud(point_cloud, voxel_size=0.005):
|
||||
o3d_pc = o3d.geometry.PointCloud()
|
||||
o3d_pc.points = o3d.utility.Vector3dVector(point_cloud)
|
||||
downsampled_pc = o3d_pc.voxel_down_sample(voxel_size)
|
||||
return np.asarray(downsampled_pc.points)
|
||||
voxel_indices = np.floor(point_cloud / voxel_size).astype(np.int32)
|
||||
unique_voxels = np.unique(voxel_indices, axis=0, return_inverse=True)
|
||||
return unique_voxels[0]*voxel_size
|
||||
|
||||
@staticmethod
|
||||
def random_downsample_point_cloud(point_cloud, num_points, require_idx=False):
|
||||
@@ -94,5 +92,8 @@ class PtsUtil:
|
||||
z_filtered_points = filtered_sampled_points[idx]
|
||||
|
||||
return z_filtered_points[:, :3]
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def point_to_hash(point, voxel_size):
|
||||
return tuple(np.floor(point / voxel_size).astype(int))
|
||||
|
Reference in New Issue
Block a user