上一篇文章实现【3D目标检测】激光雷达点云数据To二维图像:前视图。它依赖matplotlib来创建图像。下述方案:创建了一个纯粹的numpy解决方案,它应该使它更快,并且更有用,可以作为预处理步骤使用。
1 代码
import matplotlib.pyplot as plt import numpy as np
def scale_to_255(a, min, max, dtype=np.uint8): return (((a - min) / float(max - min)) * 255).astype(dtype)
def point_cloud_to_panorama(points, v_res=0.42, h_res=0.35, v_fov=(-24.9, 2.0), d_range=(0, 100), y_fudge=3 ): # Projecting to 2D x_points = points[:, 0] y_points = points[:, 1] z_points = points[:, 2] r_points = points[:, 3] d_points = np.sqrt(x_points ** 2 + y_points ** 2) # map distance relative to origin
|