繪制點(diǎn)云圖時(shí)用顏色來(lái)表征其高度, 我們先計(jì)算了點(diǎn)云的高度范圍,然后把每個(gè)點(diǎn)的顏色根據(jù)高度來(lái)進(jìn)行映射
稍微修改代碼,我們也可以讓高度顏色漸變轉(zhuǎn)換為 X 軸距離顏色漸變:
稍微修改代碼,我們也可以讓高度顏色漸變轉(zhuǎn)換為 X 軸距離顏色漸變:
?文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-624754.html
# coding:utf-8
import numpy as np
import open3d as o3d
cloud = o3d.io.read_point_cloud("kitti_p.pcd")
pts = np.asarray(cloud.points)
# 根據(jù)高度生成色彩
colors = np.zeros([pts.shape[0], 3])
height_max = np.max(pts[:, 2])
height_min = np.min(pts[:, 2])
delta_c = abs(height_max - height_min) / (255 * 2)
for j in range(pts.shape[0]):
color_n = (pts[j, 2] - height_min) / delta_c
if color_n <= 255:
colors[j, :] = [0, 1 - color_n / 255, 1]
else:
colors[j, :] = [(color_n - 255) / 255, 0, 1]
cloud.colors = o3d.utility.Vector3dVector(colors)
o3d.visualization.draw_geometries([cloud], window_name="wechat 394467238 ")
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-624754.html
到了這里,關(guān)于根據(jù)點(diǎn)云高度賦色(附open3d python代碼)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!