点云体素化

文章目录

    • 环境:
    • 1.1 体素化介绍:
    • 2.1 python代码
    • 3.1 可视化

环境:

Open3D

1.1 体素化介绍:

用一个个小体素去占据点云

2.1 python代码

conda activete deeplabv3plus(环境名称–安装好open3D的)
python demo.py

import open3d as o3d
import numpy as np

def draw_geometries(result, batch=False):
    if not batch:
        for i in range(len(result)):
            o3d.visualization.draw_geometries([result[i]], "result", 800, 600, 50, 50, False, False, True)
    else:
        o3d.visualization.draw_geometries(result, "result", 800, 600, 50, 50, False, True, True)

def main():
    result = []

    # 读取数据
    pcd = o3d.io.read_point_cloud("downsampled_pcd.pcd")  # 替换为您的 .pcd 文件路径

    # ------------------------------点云体素化处理-------------------------------
    voxel_grid = o3d.geometry.VoxelGrid.create_from_point_cloud(pcd, voxel_size=0.05)

    result.append(pcd)
    result.append(voxel_grid)

    draw_geometries(result, True)

if __name__ == "__main__":
    main()

3.1 可视化

点云体素化_第1张图片

点云体素化_第2张图片


一箭三连
⭐⭐ 祝你成功 ⭐⭐

你可能感兴趣的:(点云,python,python3.11)