Point cloud height normalization processing (python code attached)

 > Due to the differences in elevation between different surface objects, in order to remove the impact of terrain relief on the elevation value of point cloud data, it is necessary to normalize the point cloud based on the extracted ground points. This step is the basis of many algorithms. It can improve the accuracy of subsequent point cloud classification or segmentation, etc., as shown in the figure below. 

 > The normalization process is actually relatively simple. It traverses each non-ground point, finds the nearest ground point, finds the height difference between the two points, and uses the calculated height difference as the new elevation value. Normalization operation. 

import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KDTree
from mpl_toolkits.mplot3d import Axes3D
from tkinter import filedialog
import tkinter as tk

# 获取地面点云数据
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename(filetypes=[('Text Files', '*.txt')], title='Input Data-File')
if not file_path:
    print("未选择点云文件!")
    exit()

ground_data = np.loadtxt(file_path)[:, :3]

# 获取非地面点云数据
file_path = filedialog.askopenfilename(filetypes=[('Text Files', '*.txt')], title='Input Data-File')
if not file_path:
    print("未选择点云文件!")
    exit

Guess you like

Origin blog.csdn.net/a394467238/article/details/132585546