Skip to content
Snippets Groups Projects

Update README.md

Merged encinass1u requested to merge Student into main
1 file
+ 44
0
Compare changes
  • Side-by-side
  • Inline
+ 44
0
import numpy as np
import open3d as o3d
import copy
# Read .ply file
input_file = "tata_filtered.ply"
pcd = o3d.io.read_point_cloud(input_file) # Read the point cloud
# Visualize the point cloud within open3d
# o3d.visualization.draw_geometries([pcd])
# Convert open3d format to numpy array
# Here, you have the point cloud in numpy format.
Pc = np.asarray(pcd.points)
#Sf for surface
Sf = copy.deepcopy(Pc)
#Legnth of Points cloud Pc
L = len(Pc)
iter = 1
#Limits that will define the division between the 3 levels
M1 = 3.16287333
M2= 3.18335667
#Loop to arrange the values to their corresponding height from -1 to 1
while iter<= L:
for i in range (0,L):
for j in range (2, 3):
if Pc[i,j]<=M1:
Sf[i,j]=-1
elif Pc[i,j]<=M2:
Sf[i,j]=0
else:
Sf[i,j]=1
iter+=1
#Treatment of coordinate to convert them from measurements to coordinates value for a 2D plane.
Dt = copy.deepcopy(Sf)
for i in range (0,L):
for j in range (1,2):
Dt[i,j]= -int((Sf[i,j]+21.8168)/0.0052)
#For X
for i in range (0,L):
for j in range (0,1):
Dt[i,j]= -int((Sf[i,j]+8.445706367)/0.005214)
#Order the array of values Y axis from mayor to minor.
data_3 = np.flip(Dt, axis=0)
\ No newline at end of file
Loading