From 9678b9bacb29188e0398616a15919793cae5eb0a Mon Sep 17 00:00:00 2001
From: wu_xinjun <bent20140204@outlook.com>
Date: 星期一, 28 二月 2022 18:03:23 +0800
Subject: [PATCH] add slam
---
src/utils/tools.py | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/utils/tools.py b/src/utils/tools.py
index 90adc7c..463b80a 100644
--- a/src/utils/tools.py
+++ b/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)
--
Gitblit v1.9.1