2025-04-12 00:43:02 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
2025-04-12 17:22:05 +08:00
|
|
|
|
using var cloud = new PclPointCloudXYZ();
|
2025-04-12 11:37:29 +08:00
|
|
|
|
cloud.Load("./dataset/0.pcd");
|
2025-04-12 17:34:38 +08:00
|
|
|
|
Console.WriteLine("加载点云大小为:" + cloud.Size);
|
2025-04-12 00:43:02 +08:00
|
|
|
|
|
2025-04-12 17:22:05 +08:00
|
|
|
|
using var voxel = new PclVoxelGridXYZ();
|
2025-04-12 11:37:29 +08:00
|
|
|
|
voxel.SetLeafSize(0.1f, 0.1f, 0.1f);
|
2025-04-12 00:43:02 +08:00
|
|
|
|
voxel.SetInputCloud(cloud);
|
|
|
|
|
|
|
|
|
|
using var filtered = voxel.Filter();
|
2025-04-12 17:34:38 +08:00
|
|
|
|
Console.WriteLine("体素滤波后点云大小为:" + filtered.Size);
|
2025-04-12 00:43:02 +08:00
|
|
|
|
filtered.Save("output.pcd");
|
|
|
|
|
}
|
|
|
|
|
}
|