Common Vision Blox 15.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Friends Modules Pages
Load, Save, and Create Point Clouds

In CVB point clouds can be created in the following ways:

  • By loading them from a file.
  • By directly specifying data type and size.
  • By calibrating a range map acquired through a laser triangulation system or an Area3D sensor.

All the relevant functions for these operations can be found either in the point cloud factory or the point cloud classes:

Load and Save Point Clouds

A point cloud can be simply loaded from or saved to a file by the following call:

#include <cvb/point_cloud_factory.hpp>
#include <cvb/point_cloud.hpp>
auto file = CVB_LIT("cloud.ply");
auto cloud = Cvb::PointCloudFactory::Load(file, Cvb::PointCloudFlags::Float);
cloud->Save(CVB_LIT("same_cloud.ply"));
static std::shared_ptr< T > Load(const String &fileName, PointCloudFlags flags)

var file = "cloud.ply"
var cloud = Cvb.PointCloud.FromFile(file);
cloud.Save("same_cloud.ply");
void Save(const String &fileName) const

file = "cloud.ply"
cloud = cvb.PointCloudFactory.load(file, cvb.PointCloudFlags.Float)
cloud.save("same_cloud.ply")
Union[cvb.DensePointCloud, cvb.SparsePointCloud] load(str file_name, int flags)

If you know whether the point cloud is an un-organized sparse or an organized dense point cloud at the time of loading, you can specify the type as as follows:

auto file = CVB_LIT("dense_cloud.tif");
auto cloudDense = Cvb::PointCloudFactory::Load<Cvb::DensePointCloud>(file, Cvb::PointCloudFlags::Float);
cloudDense->Save(CVB_LIT("same_dense_cloud.tif"));

var file = "dense_cloud.tif"
var denseCloud = Cvb.PointCloud.FromFile(file) as DensePointCloud;
denseCloud.Save("same_dense_cloud.tif");

Note, that un-organized dense point clouds can only be loaded from and saved to TIFF or PCL files (see section below). In Python, the specific point cloud type is directly returned by cvb.PointCloudFactory.load.

Supported Point Cloud File Formats

The following point cloud file formats are supported:

Format Extension(s) Supported Point Cloud Type
Cvb::DensePointCloud Cvb::SparsePointCloud Cvb::Mesh
Polygon File Format ply x
Stereo Lithography stl x
Wavefront OBJ, obj x
ASCII asc, pts, txt, xyz x x
TIFF tif, tiff x
PCL Format pcd x

Additional notes:

  • PCL Format: The following point types are supported for PCL format: PointXYZ, PointXYZI, PointXYZRGB, PointXYZNormal. If the point cloud contains additional layers, only X,Y and Z coordinates are read. PCD files without XYZ coordinates are not supported.
  • TIFF files: TIFF files are interpreted as point clouds. Three sample float or double files are supported, with the samples interpreted as X, Y, and Z coordinates. To load a TIFF as a range map, use Cvb::Image::Load and convert it to point cloud (refer to the section Creating a Calibrated Point Cloud with CVB).

Create a Point Cloud

In CVB, several functions are available for creating a point cloud by specifying the data type and size. These functions can be found either in the point cloud factory or the point cloud classes:

Create a Calibrated Point Cloud from a Range Map

Acquiring range maps via a laser triangulation system requires calibration to obtain metric X, Y, and Z coordinates. Similarly, Area3D sensors that provide height maps (referred to as Zmaps) need to be converted into metric coordinates. A guide on how to perform these tasks with CVB can be found in the section Creating a Calibrated Point Cloud with CVB.