# 点云TXT文档合并 nploadtxt方式 def combine_txt_npload(): """ 点云TXT文档合并 nploadtxt方式 :return: data, 合并点云数据,数据类型 numpy.ndarray """ # import numpy as np import os import tkinter as tk from tkinter import filedialog import numpy as np # Open a file dialog to choose the text files root = tk.Tk() root.withdraw() file_paths = filedialog.askopenfilenames(filetypes=[("Text files", "*.txt")]) # Load the text files and combine them together data = None for file_path in file_paths: file_name = os.path.basename(file_path)[:-4] # Load the data from the file, skipping the first row file_data = np.loadtxt(file_path, skiprows=1) num_rows = file_data.shape[0] # Combine the data with the existing data, if any if data is None: data = file_data else: data = np.vstack((data, file_data)) # The combined data is now stored in the `data` variable return data
打开路径选择点云TXT文件并合并,返回点云数据
最新推荐文章于 2024-08-16 18:55:06 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)