Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
romanzes637 authored Dec 4, 2019
1 parent 9f965f4 commit d255a27
Show file tree
Hide file tree
Showing 22 changed files with 79,629 additions and 0 deletions.
13 changes: 13 additions & 0 deletions center.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import open3d as o3d
import numpy as np

if __name__ == "__main__":
file_path = 'conferenceRoom_1.xyzrgb'
pcd = o3d.io.read_point_cloud(file_path)
vis = o3d.visualization.VisualizerWithEditing()
# color bug fixing xyzrgb (float rgb?)
if np.max(pcd.colors) > 1:
pcd.colors = o3d.utility.Vector3dVector(np.asarray(pcd.colors)/255)
pcd.points = o3d.utility.Vector3dVector(
pcd.points - np.mean(pcd.points, axis=0, keepdims=True))
o3d.io.write_point_cloud("center.ply", pcd, write_ascii=True)
9 changes: 9 additions & 0 deletions cube.pts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
8
0 0 0
1 0 0
1 1 0
0 1 0
0 0 1
1 0 1
1 1 1
0 1 1
23 changes: 23 additions & 0 deletions norm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import open3d as o3d
import numpy as np

if __name__ == "__main__":
file_path = 'conferenceRoom_1.xyzrgb'
# norm_type = 'coord_max'
norm_type = 'abs_max'
pcd = o3d.io.read_point_cloud(file_path)
vis = o3d.visualization.VisualizerWithEditing()
# color bug fixing xyzrgb (float rgb?)
if np.max(pcd.colors) > 1:
pcd.colors = o3d.utility.Vector3dVector(np.asarray(pcd.colors)/255)
points_min = np.min(pcd.points, axis=0)
points_ptp = np.ptp(pcd.points, axis=0) # max - min
print(points_min, points_ptp)
if norm_type == 'coord_max':
pcd.points = o3d.utility.Vector3dVector(
(pcd.points - points_min) / points_ptp)
else:
pcd.points = o3d.utility.Vector3dVector(
(pcd.points - points_min) / max(points_ptp))
print(np.min(pcd.points), np.max(pcd.points))
o3d.io.write_point_cloud("norm.ply", pcd, write_ascii=True)
Loading

0 comments on commit d255a27

Please sign in to comment.