点云结构和输出格式
结构点云
Zivid outputs an organized point cloud by default. This means that the point cloud is laid out as a 2D array of points that resembles an image-like structure.
这种结构有几个优点。
为无结构点云设计的算法也可以用于结构点云,因为2D数组可以看做1D数组。 而相反情况并不总是正确的。
有序点云在2D图像(颜色和深度)中的像素与点云中的3D点之间具有1:1的相关性。 这意味着图像中的相邻像素是点云中的相邻点。 这使得2D操作和算法能够应用于2D图像,而结果可以直接应用于点云。 例如,对物体的检测和分割,可以分割2D图像并直接从所需像素中提取3D点。
点的有序性加快了计算并降低了某些算法的消耗,尤其是使用相邻点的操作。
Unorganized point cloud
An unorganized point cloud is a list of points in a 1D array. Each point contains the same information as in the organized point cloud.
There are advantages to unorganized point clouds as well.
Since the mapping to sensor pixel is not preserved, neither are points without information (NaN). As a result, unorganized point clouds can be smaller in size than organized point clouds.
When you combine multiple point clouds, it is easier to merge them into a single unorganized point cloud.
备注
It is possible to get back the pixel indices from an unorganized point cloud. This can be done using intrinsics. However, the intrinsics model does not cover the full calibration of the camera. The only way to truly get correct pixel mapping is to use the organized point cloud. See 相机内参 for more information.
Zivid点云
不同型号的Zivid相机使用了具有不同分辨率的传感器来捕获场景的点云。
相机 |
百万像素 (MP) |
分辨率 |
---|---|---|
Zivid 2+ |
5 |
2448 x 2048 |
Zivid 2 |
2.3 |
1944 x 1200 |
有多种方法可以从SDK获取分辨率信息。
const auto cameraInfo = camera.info();
auto defaultSettings = Zivid::Experimental::SettingsInfo::defaultValue<Zivid::Settings>(cameraInfo);
defaultSettings.acquisitions().emplaceBack(
Zivid::Experimental::SettingsInfo::defaultValue<Zivid::Settings::Acquisition>(cameraInfo));
defaultSettings.set(Zivid::Settings::Color{
Zivid::Experimental::SettingsInfo::defaultValue<Zivid::Settings2D>(cameraInfo)
.copyWith(Zivid::Settings2D::Acquisitions{
Zivid::Experimental::SettingsInfo::defaultValue<Zivid::Settings2D::Acquisition>(cameraInfo) }) });
std::cout << "Camera resolution for default settings:" << std::endl;
const auto resolution = Zivid::Experimental::SettingsInfo::resolution(cameraInfo, defaultSettings);
std::cout << " Height: " << resolution.height() << std::endl;
std::cout << " Width: " << resolution.width() << std::endl;
std::cout << "Point cloud (GPU memory) resolution:" << std::endl;
const auto pointCloud = camera.capture2D3D(defaultSettings).pointCloud();
std::cout << " Height: " << pointCloud.height() << std::endl;
std::cout << " Width: " << pointCloud.width() << std::endl;
std::cout << "Point cloud (CPU memory) resolution:" << std::endl;
const auto data = pointCloud.copyPointsXYZColorsRGBA_SRGB();
std::cout << " Height: " << data.height() << std::endl;
std::cout << " Width: " << data.width() << std::endl;
生成的点云由500万个点组成。由于像素和点之间存在1:1的相关性,因此可以获得每个像素的 XYZ(mm)、RGB(8 位)和SNR,其中SNR是信噪比。在GPU内部,3D坐标、颜色值和SNR值分别被存储为大小为 2448 x 2048 的单独二维数组。在用户端(CPU内存),数据可以以不同的格式存储,具体取决于请求的方式。请参阅 点云教程 了解相关详细说明。
生成的点云由230万个点组成。由于像素和点之间存在1:1的相关性,因此可以获得每个像素的 XYZ(mm)、RGB(8 位)和SNR,其中SNR是信噪比。在GPU内部,3D坐标、颜色值和SNR值分别被存储为大小为 1944 x 1200 的单独二维数组。在用户端(CPU内存),数据可以以不同的格式存储,具体取决于请求的方式。请参阅 点云教程 了解相关详细说明。

颜色图像和深度图像可以直接从Zivid点云中提取。您可以 从 GitHub repository 中找到相关示例。
Zivid输出格式
在ZividStudio中,您可以将点云保存在Zivid数据文件(*.zdf)中。 此外,您也可以将点云导出(File → Export)为以下格式:
Polygon (PLY)
Point Cloud Data (PCD)
ASCII(XYZ)
对于每种格式,您可以在从 Zivid Studio 导出时选择不同的导出选项,例如 颜色空间 和 法线 。
PLY、PCD 和 XYZ 文件格式的导出选项。
Zivid数据文件 (*.zdf) 是原生的Zivid文件格式。 如果您使用API,您可以遍历点云并以您喜欢的任何格式保存X、Y、Z、R、G、B和SNR数据。 查看我们的示例来了解如何使 用 C++ 、 C# 、 Python 和 MATLAB 读取或转换Zivid数据。
小技巧
查看Zivid点云的最简单方法是将ZDF文件复制到您的PC上,并使 用 Zivid Studio 来查看点云。或者您也可以使用API将ZDF转换为PLY(或使用我们 的 Python script ),然后使用3D查看器来勘察,例如 MeshLab 或 者 CloudCompare。
ASCII points (*.xyz)
ASCII字符用于存储笛卡尔坐标。 XYZ用空格隔开。在我们的版本中,还为每个点添加了RGB值。每个新点都用换行符隔开。该文件可以在常规文本编辑器中查看。
PLY file (*.ply)
PLY是斯坦福大学开发的一种文件格式 。 Learn more about PLY。
Point Cloud Data file (*.pcd)
PCD是点云库的原生文件格式 。 了解更多关于PCD的内容。
使用 Experimental::PointCloudExport::exportFrame
API 通过 Zivid SDK 将点云导出为您喜欢的格式。
如果您使用 Frame::save
API 将点云导出到 PCD,请阅读此内容
结构PCD格式
使用 Frame::save
时,Zivid SDK 保存有序点云时带有一个标头,用于指示一个无序点云。从 SDK 2.5 开始,可以使用 Config.yml 文件配置 SDK,以便导出带有正确标头(用于指示有序点云)的 PCD。如果该文件已存在,且位于 Windows 系统的 %LOCALAPPDATA%\Zivid\API
或 Ubuntu 系统的 "${XDG_CONFIG_HOME-$HOME/.config}"/Zivid/API
中,请更新 Configuration/APIBreakingBugFixes/FileFormats/PCD/UseOrganizedFormat
。
如果文件不存在:
下 载
Config.yml
文件。配置文件包含以下信息:
__version__: serializer: 1 data: 12 Configuration: APIBreakingBugFixes: FileFormats: PCD: UseOrganizedFormat: yes
将配置文件放在以下目录中:
mkdir %LOCALAPPDATA%\Zivid\API move %HOMEPATH%\Downloads\Config.yml %LOCALAPPDATA%\Zivid\API\
mkdir --parents "${XDG_CONFIG_HOME-$HOME/.config}"/Zivid/API mv ~/Downloads/Config.yml "${XDG_CONFIG_HOME-$HOME/.config}"/Zivid/API/
小心
任何现有的配置文件都将被覆盖。
小心
Zivid配置文件必须使用.yml文件扩展名(而不是.yaml)。
Version History
SDK |
Changes |
---|---|
2.16.0 |
Added support for |