wu_xinjun
2022-02-28 9678b9bacb29188e0398616a15919793cae5eb0a
src/utils/tools.py
@@ -1,4 +1,5 @@
import os, sys
import numpy as np
def file_fliter(folder:str, file_ext:str, sort_format):
@@ -13,5 +14,34 @@
    target_files.sort(key=sort_format)
    return target_files
def read_ply(path:str,start_line:int = 10):
    count = 0
    ply_list = []
    with open(path,"r") as ply_file:
        # read the line
        for line in ply_file.readlines():
            # strip the str of the header
            if count < start_line:
                pass
            else:
                line_str_list = line.strip().split(' ')
                # convert the str type to float type
                line_float_list = []
                for value in line_str_list:
                    line_float_list.append(float(value))
                ply_list.append(line_float_list)
            count += 1
    ply_array = np.array(ply_list,dtype=np.float16)
    return ply_array
if __name__ == "__main__":
    ply_array = read_ply('src\\microwave\\demo\\demoData\\2522.ply')
    print(type(ply_array))
    print(ply_array)