Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
shnhrtkyk authored Mar 6, 2022
1 parent 92b2edb commit 538d2f0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from plyfile import PlyData, PlyElement, PlyProperty, PlyListProperty
from os import listdir,path

to_ascii = False
file_path = 'D:/DALES/dales_semantic_segmentation_ply/dales_ply/train'
files = [f for f in listdir(file_path) if f[-4:] == '.ply']
for each_file in files:
print('\n Loading.... ', path.join(file_path, each_file) )
data = PlyData.read(path.join(file_path, each_file) )
print('\n Loaded..... ', path.join(file_path, each_file) )
data.elements[0].data.dtype.names = ['x', 'y', 'z', 'reflectance', 'class']
data.elements[0].properties = (PlyProperty('x', 'float'), PlyProperty('y', 'float'),
PlyProperty('z', 'float'), PlyProperty('reflectance', 'int'),
PlyProperty('class', 'int'))
data1 = PlyData([data.elements[0]], text=to_ascii)
data1.write(path.join(file_path,'bin_'+ each_file) )
print('\n completed.. ', each_file)
data2 = PlyData.read(path.join(file_path, 'bin_'+each_file) )
print(data.elements[0])
print('\n')

0 comments on commit 538d2f0

Please sign in to comment.