1、使用ExtractIndices滤波器,可以提取出点云中的子集。
2、代码:
using PclSharp;
using PclSharp.Common;
using PclSharp.Filters;
using PclSharp.Helpers;
using PclSharp.IO;
using PclSharp.SampleConsensus;
using PclSharp.Segmentation;
using PclSharp.Std;
using PclSharp.Struct;
using System;
using System.Numerics;
using System.Text;
namespace PclSharpTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine($"C#--PclSharp算法库测试:");
//读取点云文件
var inCloud = new PointCloudOfXYZ();
using (var reader = new PCDReader())
reader.Read(AppDomain.CurrentDomain.BaseDirectory + $"//pcd//table.pcd", inCloud);
Console.WriteLine($"PointCloud before filtering:{inCloud.Count}data points");
//采用体素化滤波进行下采样:
PointCloudOfXYZ cloud_filtered = new PointCloudOfXYZ();//滤波后的点云
PointXYZ voxelpointXYZ = new PointXYZ { X = 0.01f, Y = 0.01f, Z = 0.01f };
using (var sor = new PclSharp.Filters.VoxelGridOfXYZ())
{
sor.SetInputCloud(inCloud);
sor.LeafSize = voxelpointXYZ;//体素点的大小
sor.filter(cloud_filtered);
}
//保存下采样后点云
&nb

最低0.47元/天 解锁文章
4368

被折叠的 条评论
为什么被折叠?



