降采样

小技巧

我们的网络研讨会 Getting your point cloud ready for your application (为您的应用准备好点云)部分涵盖了降采样的相关内容。

介绍

本文介绍了降采样的概念,解释了它为何有价值并演示了如何对Zivid点云进行降采样。

Zivid 2+ 相机使用具有5 MP ( 2448 x 2048 ) 的传感器来捕获场景的点云。点云由XYZ(3D)、RGB(颜色)和SNR数据组成。生成的点云由500万个点组成。

Zivid 2 相机使用具有2.3 MP ( 1944 x 1200 ) 的传感器来捕获场景的点云。点云由XYZ(3D)、RGB(颜色)和SNR数据组成。生成的点云由230万个点组成。

Zivid One+ 相机使用具有2.3 MP ( 1920 x 1200 ) 的传感器来捕获场景的点云。点云由XYZ(3D)、RGB(颜色)和SNR数据组成。生成的点云由230万个点组成。

Some applications do not require high-density point cloud data. Examples are box detection by fitting a plane to the box surface and CAD matching, where the object has distinct and easily identifiable features. In addition, this amount of data is often too large for machine vision algorithms to process with the speed required by the application. It is such applications where point cloud downsampling comes into play.

点云上下文中的降采样是在保持相同3D表征的情况下降低空间分辨率。它通常用于将数据转换为更易于管理的大小,从而减少存储和处理要求。

问题

点云的大小或分辨率(密度)太大。

解决方案

对Zivid点云进行降采样以减小其大小和分辨率。

备注

This article discusses downsampling applied during post-processing; for a hardware-based subsampling method that reduces resolution and, by that, also the capture time, please refer to the Monochrome Capture.

降采样API

可以就地进行降采样,从而修改当前点云。

跳转到源码

源码

pointCloud.downsample(Zivid::PointCloud::Downsampling::by2x2);
跳转到源码

源码

pointCloud.Downsample(Zivid.NET.PointCloud.Downsampling.By2x2);
跳转到源码

源码

point_cloud.downsample(zivid.PointCloud.Downsampling.by2x2)

也可以将降采样后的点云作为一个新的点云实例,它不会改变现有的点云。

跳转到源码

源码

auto downsampledPointCloud = pointCloud.downsampled(Zivid::PointCloud::Downsampling::by2x2);
跳转到源码

源码

var downsampledPointCloud = pointCloud.Downsampled(Zivid.NET.PointCloud.Downsampling.By2x2);
跳转到源码

源码

downsampled_point_cloud = point_cloud.downsampled(zivid.PointCloud.Downsampling.by2x2)

Zivid SDK支持以下降采样率: by2x2, by3x3, 和 by4x4, 可以进行多次降采样。

备注

Zivid SDK中的降采样API速度很快,因为它是在GPU上并行完成的,而此时点云数据仍在GPU内存中。使用第三方库进行降采样可能更耗时:CPU计算通常要慢得多,而GPU计算则需要多出一次数据复制过程。查看 点云捕获过程 了解更多信息。

如果您对如何实现该功能感兴趣,请查看我们的降采样代码示例 C++, C#, Python, 和 MATLAB

小技巧

  • 出于性能原因的考量,可以将降采样API与转换和法线API结合使用,因为GPU执行所有这些计算时, 点云数据仍在GPU内存中时。

  • 为了最快地完成数据处理,可以先对点云进行降采样,然后对其进行转换。

如需对点云进行降采样,您可以运行我们的代码示例。

示例: downsample.py

python /path/to/downsample.py --zdf-path /path/to/file.zdf

要了解有关如何进行降采样以及它为什么并非是一个无足轻重的功能,请查看文章 降采样理论

版本历史

SDK

变更

2.1.0

添加了降采样API。

2.10.0

Monochrome Capture introduces a faster alternative to downsampling.