CVB++ 14.1
PointCloudFactory Class Reference

Factory object for creating point cloud objects. More...

#include <cvb/point_cloud_factory.hpp>

Static Public Member Functions

template<class T >
static std::shared_ptr< T > Load (const String &fileName, PointCloudFlags flags)
 Loads a 3D point, polygon or mesh file (typed). More...
 
static PointCloudPtr Load (const String &fileName, PointCloudFlags flags)
 Loads a 3D point, polygon or mesh file. More...
 
static PointCloudPtr Create (const ImagePlane &rangeMap, const Calibrator3D &calibrator, PointCloudFlags flags)
 Creates a new Cartesian 3D point cloud from the given 2.5D range map image. More...
 
template<class T >
static std::shared_ptr< T > Create (const ImagePlane &rangeMap, const Calibrator3D &calibrator, PointCloudFlags flags)
 Creates a new Cartesian 3D point cloud from the given 2.5D range map image (typed). More...
 
static PointCloudPtr CreateWithSettings (const ImagePlane &rangeMap, const Calibrator3D &calibrator, PointCloudFlags flags, const SensorSettings &settings, double encoderStep)
 Creates a new Cartesian 3D point cloud from the given 2.5D range map image with modified camera settings. More...
 
template<class T >
static std::shared_ptr< T > CreateWithSettings (const ImagePlane &rangeMap, const Calibrator3D &calibrator, PointCloudFlags flags, const SensorSettings &settings, double encoderStep)
 Creates a new Cartesian 3D point cloud from the given 2.5D range map image with modified camera settings (typed). More...
 
static SparsePointCloudPtr CreateSparse (std::size_t numPoints, PointCloudFlags flags)
 Creates a new sparse Cartesian 3D point cloud. More...
 
static SparsePointCloudPtr CreateSparse (const std::vector< void * > &planeBasePtrs, int numPlanes, Cvb::DataType dataType, std::size_t numPoints, const std::vector< std::intptr_t > &planeIncs)
 Creates a point cloud from the given memory without copying the data. More...
 
static DensePointCloudPtr CreateDense (Size2D< int > size, PointCloudFlags flags)
 Creates a new dense Cartesian 3D point cloud. More...
 
static DensePointCloudPtr CreateDense (const Cvb::ImagePlane &rangeMap, Factors3D factors, PointCloudFlags flags)
 Creates a new Cartesian 3D point cloud from the given 2.5D range map image. More...
 

Detailed Description

Factory object for creating point cloud objects.

Member Function Documentation

◆ Create() [1/2]

static PointCloudPtr Create ( const ImagePlane rangeMap,
const Calibrator3D calibrator,
PointCloudFlags  flags 
)
inlinestatic

Creates a new Cartesian 3D point cloud from the given 2.5D range map image.

Depending on the calibration method the point cloud resulting from the untyped function PointCloudFactory::Create is a DensePointCloud or a SparsePointCloud. Note, that if this output point cloud is dense, the confidence layer is always available. Background range map pixels are set non-confident. In case of a sparse point cloud, points representing background values and also the confidence layer are removed (except the user explicitly wants to keep the confidence layer which can be requested via the point cloud flags).

Only range maps with floating point and unsigned integer DataType values are supported. For unsigned integer data types, the following DataType::BytesPerPixel values are supported: 1, 2 and 4. Note, that only linear access is supported (check with function ImagePlane::TryLinearAccess).

Note
Creating a calibrated point cloud, the camera settings applied during the acquisition of the range map have to be known. Default settings are read from the calibrator loaded from a calibration file. If the actual settings differ from the default ones, the user has to set them and create a calibrated point cloud with function PointCloudFactory::CreateWithSettings.
Parameters
[in]rangeMapHandle of 2.5D image plane.
[in]calibratorCalibration object to apply.
[in]flagsFlags specifying the kind of point cloud to be created.
Returns
A pointer to the point cloud.
Exceptions
Anyexception derived from std::exception including CvbException.
Examples
Cvb/CppPointCloudCreateCalibrated, Foundation/CppMetricCalibration, Foundation/CppMetricCalibrationInclinationLaserPlane, and Foundation/CppMetricCalibrationRigidBodyTrafo.

◆ Create() [2/2]

static std::shared_ptr< T > Create ( const ImagePlane rangeMap,
const Calibrator3D calibrator,
PointCloudFlags  flags 
)
inlinestatic

Creates a new Cartesian 3D point cloud from the given 2.5D range map image (typed).

The point cloud will automatically be converted to the given type.

Attention
If the the given type is a DensePointCloud, but the created point cloud actually would be a SparsePointCloud (applies to calibrators containing an affine matrix, which can be checked with LaserPlaneCalibrator3D::CorrectionOfLaserPlaneInclination and Calibrator3D::ExtrinsicMatrix), the point cloud will be converted with function SparsePointCloud::ToDensePointCloud. Be aware, that point clouds created with SparsePointCloud::ToDensePointCloud might have gaps! In general type DensePointCloud is not recommended for calibrators containing an affine matrix!

Depending on the calibration method the point cloud resulting from the untyped function PointCloudFactory::Create is a DensePointCloud or a SparsePointCloud. Note, that if this output point cloud is dense, the confidence layer is always available. Background range map pixels are set non-confident. In case of a sparse point cloud, points representing background values and also the confidence layer are removed (except the user explicitly wants to keep the confidence layer which can be requested via the point cloud flags).

Only range maps with floating point and unsigned integer DataType values are supported. For unsigned integer data types, the following DataType::BytesPerPixel values are supported: 1, 2 and 4. Note, that only linear access is supported (check with function ImagePlane::TryLinearAccess).

Note
Creating a calibrated point cloud, the camera settings applied during the acquisition of the range map have to be known. Default settings are read from the calibrator loaded from a calibration file. If the actual settings differ from the default ones, the user has to set them and create a calibrated point cloud with function PointCloudFactory::CreateWithSettings.
Parameters
[in]rangeMapHandle of 2.5D image plane.
[in]calibratorCalibration object to apply.
[in]flagsFlags specifying the kind of point cloud to be created.
Returns
A pointer to the point cloud.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ CreateDense() [1/2]

static DensePointCloudPtr CreateDense ( const Cvb::ImagePlane rangeMap,
Factors3D  factors,
PointCloudFlags  flags 
)
inlinestatic

Creates a new Cartesian 3D point cloud from the given 2.5D range map image.

Only range maps with floating point and unsigned integer DataType values are supported. For unsigned integer data types, the following DataType::BytesPerPixel values are supported: 1, 2 and 4. Note, that only linear access is supported (check with function ImagePlane::TryLinearAccess).

Parameters
[in]rangeMap2.5D image plane.
[in]factorsFactors to apply.
[in]flagsSpecifying the kind of point cloud to be created.
Returns
The size as number of columns and number of rows.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ CreateDense() [2/2]

static DensePointCloudPtr CreateDense ( Size2D< int >  size,
PointCloudFlags  flags 
)
inlinestatic

Creates a new dense Cartesian 3D point cloud.

The resulting point cloud will always have a contiguous point array. Creating the point cloud with with PointCloudFlags::XYZConfidence will provide interleaved XYZConfidence (PointCloudLayout will be Linear), whereas creating it with PointCloudFlags::WithConfidence, only XYZ will be interleaved but not the confidence plane (PointCloudLayout will be Interleaved).

Parameters
[in]sizeNumber of Cartesian X, Y, Z(, W) points on the x/y-component of the lattice.
[in]flagsSpecifying the kind of point cloud to be created.
Returns
The variable to receive the handle of the point cloud object.
Exceptions
Anyexception derived from std::exception including CvbException.
Examples
Cvb/CppPointCloudCreateAndHandle.

◆ CreateSparse() [1/2]

static SparsePointCloudPtr CreateSparse ( const std::vector< void * > &  planeBasePtrs,
int  numPlanes,
Cvb::DataType  dataType,
std::size_t  numPoints,
const std::vector< std::intptr_t > &  planeIncs 
)
inlinestatic

Creates a point cloud from the given memory without copying the data.

Parameters
[in]planeBasePtrsBase pointers of the X, Y, Z and optionally W component planes.
[in]numPlanesNumber of pPlaneBasePtrs.
[in]dataTypeData type of the pPlaneBasePtrs.
[in]numPointsNumber of elements in each plane.
[in]planeIncsOffset to the next component in the respective plane in bytes.
Returns
The variable to receive the handle of the point cloud object.
Exceptions
Anyexception derived from std::exception including CvbException.

Currently only single precision (float) data type is supported. Also currently number of planes must be 3.

◆ CreateSparse() [2/2]

static SparsePointCloudPtr CreateSparse ( std::size_t  numPoints,
PointCloudFlags  flags 
)
inlinestatic

Creates a new sparse Cartesian 3D point cloud.

The resulting point cloud will always have a contiguous point array. Creating the point cloud with with PointCloudFlags::XYZConfidence will provide interleaved XYZConfidence (PointCloudLayout will be Linear), whereas creating it with PointCloudFlags::WithConfidence, only XYZ will be interleaved but not the confidence plane (PointCloudLayout will be Interleaved).

Parameters
[in]numPointsNumber of Cartesian X, Y, Z(, W) points.
[in]flagsSpecifying the kind of point cloud to be created.
Returns
The variable to receive the handle of the point cloud object.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ CreateWithSettings() [1/2]

static PointCloudPtr CreateWithSettings ( const ImagePlane rangeMap,
const Calibrator3D calibrator,
PointCloudFlags  flags,
const SensorSettings settings,
double  encoderStep 
)
inlinestatic

Creates a new Cartesian 3D point cloud from the given 2.5D range map image with modified camera settings.

Creating a calibrated point cloud, the camera settings applied during the acquisition of the range map have to be known. Default settings are read from the calibrator loaded from a calibration file. If the actual settings differ from the default ones, the user has to set them and create a calibrated point cloud via function this function. You can get and check the default settings via LaserPlaneCalibrator3D::SensorSettings. The default encoder step can also be get from the calibrator via function LaserPlaneCalibrator3D::YFactor.

Depending on the calibration method the point cloud resulting from the untyped function PointCloudFactory::CreateWithSettings is a DensePointCloud or a SparsePointCloud. Note, that if this output point cloud is dense, the confidence layer is always available. Background range map pixels are set non-confident. In case of a sparse point cloud, points representing background values and also the confidence layer are removed (except the user explicitly wants to keep the confidence layer which can be requested via the point cloud flags).

Only range maps with floating point and unsigned integer DataType values are supported. For unsigned integer data types, the following DataType::BytesPerPixel values are supported: 1, 2 and 4. Note, that only linear access is supported (check with function ImagePlane::TryLinearAccess).

Parameters
[in]rangeMapHandle of 2.5D image plane.
[in]calibratorCalibration object to apply.
[in]flagsFlags specifying the kind of point cloud to be created.
[in]settingsSensor settings applied during the acquisition of the range map.
[in]encoderStepEncoder step.
Returns
A pointer to the point cloud.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ CreateWithSettings() [2/2]

static std::shared_ptr< T > CreateWithSettings ( const ImagePlane rangeMap,
const Calibrator3D calibrator,
PointCloudFlags  flags,
const SensorSettings settings,
double  encoderStep 
)
inlinestatic

Creates a new Cartesian 3D point cloud from the given 2.5D range map image with modified camera settings (typed).

The point cloud will automatically be converted to the given type.

Attention
If the the given type is a DensePointCloud, but the created point cloud actually would be a SparsePointCloud (applies to calibrators containing an affine matrix, which can be checked with LaserPlaneCalibrator3D::CorrectionOfLaserPlaneInclination and Calibrator3D::ExtrinsicMatrix), the point cloud will be converted with function SparsePointCloud::ToDensePointCloud. Be aware, that point clouds created with SparsePointCloud::ToDensePointCloud might have gaps! In general type DensePointCloud is not recommended for calibrators containing an affine matrix!

Creating a calibrated point cloud, the camera settings applied during the acquisition of the range map have to be known. Default settings are read from the calibrator loaded from a calibration file. If the actual settings differ from the default ones, the user has to set them and create a calibrated point cloud via function this function. You can get and check the default settings via LaserPlaneCalibrator3D::SensorSettings. The default encoder step can also be get from the calibrator via function LaserPlaneCalibrator3D::YFactor.

Depending on the calibration method the point cloud resulting from the untyped function PointCloudFactory::CreateWithSettings is a DensePointCloud or a SparsePointCloud. Note, that if this output point cloud is dense, the confidence layer is always available. Background range map pixels are set non-confident. In case of a sparse point cloud, points representing background values and also the confidence layer are removed (except the user explicitly wants to keep the confidence layer which can be requested via the point cloud flags).

Only range maps with floating point and unsigned integer DataType values are supported. For unsigned integer data types, the following DataType::BytesPerPixel values are supported: 1, 2 and 4. Note, that only linear access is supported (check with function ImagePlane::TryLinearAccess).

Parameters
[in]rangeMapHandle of 2.5D image plane.
[in]calibratorCalibration object to apply.
[in]flagsFlags specifying the kind of point cloud to be created.
[in]settingsSensor settings applied during the acquisition of the range map.
[in]encoderStepEncoder step.
Returns
A pointer to the point cloud.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Load() [1/2]

static std::shared_ptr< T > Load ( const String fileName,
PointCloudFlags  flags 
)
inlinestatic

Loads a 3D point, polygon or mesh file (typed).

Parameters
[in]fileNameFull path to the file to load.
[in]flagsPointCloudFlags specifying the kind of point cloud to be created.
Returns
A typed pointer to the point cloud.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Load() [2/2]

static PointCloudPtr Load ( const String fileName,
PointCloudFlags  flags 
)
inlinestatic

Loads a 3D point, polygon or mesh file.

Parameters
[in]fileNameComplete path to the file to load.
[in]flagsFlags specifying the kind of point cloud to be created.
Returns
A pointer to the point cloud.
Exceptions
Anyexception derived from std::exception including CvbException.