Example programs for generating point clouds using a calibration file are available in C++ and Python. You can find them in your CVB setup under %cvb%Tutorial/Image Manager or in the online documentation, as listed in the table below:
Link to Example | Location in your CVB Setup | |
---|---|---|
C++ | CppPointCloudCreateCalibrated | %cvb%Tutorial/Image Manager/Cvb++/CppPointCloudCreateCalibrated |
Python | CreateAndAccessCalibratedPointCloud | %cvb%Tutorial/Image Manager/CVBpy/CreateAndAccessCalibratedPointCloud |
The creation of calibrated point clouds is implemented in the CVCore3D.dll. To execute the code snippets provided in this documentation, following DLLs are additionally required:
To utilize this functionality, the following namespaces and include files are required:
The following sections outline the process for applying a specific calibration. For details on managing background values, refer to section Handling Background Values.
Many area-based 3D sensors provide calibrated point clouds or height maps, commonly referred to as ZMaps, along with resolution values for the x, y, and z dimensions.
To generate a metrically calibrated point cloud from these ZMaps, the resolution factors must be applied. CVB offers functionality to handle this process. The following code example demonstrates how to load a ZMap and apply the provided resolution factors, resulting in an organized (dense) point cloud:
This code example demonstrates how to generate not only the x, y, and z planes but also a confidence plane, defined through the point cloud flags. For further information refer to section Handling Background Values.
Laser triangulation setups require a more advanced calibration process (see also the section on Calibration Theory). The calibration parameters are typically stored in JSON or XML files. The following sections provide detailed instructions on how to apply these calibrations.
For the intrinsic calibration, CVB supports the following types of calibration files:
After loading the range map and the calibration file, the point cloud can be created as the following code snippet demonstrates:
When applying only an intrinsic calibration, the resulting point cloud is always organized (dense). For C++ it is recommended to use the template argument DensePointCloud
to avoid the need for casting when accessing the specific functionalities of a DensePointCloud
.
When creating an intrinsically calibrated (dense) point cloud, it is recommended to include an additional confidence plane, as explained in section Handling Background Values.
The CVB AQS12 calibration generates a JSON file containing both intrinsic and extrinsic calibration data. The following code snippet demonstrates how to apply this calibration to a range map to generate a calibrated point cloud:
When applying an extrinsic calibration, the resulting point cloud is un-organized (sparse). Background values are excluded as explained in section Handling Background Values.
If you have already received a point cloud from your camera and wish to transform it into a superordinate coordinate system (typically through a rigid-body transformation), you can achieve this using the following code:
Note, that when transforming a point cloud with the Transform
function, the resulting point cloud is always un-organized (sparse).
Empty background areas within the range map should be excluded from the calibration process. To achieve this, users have to define the background value using the RangeMapIgnoreValue
parameter. By default, the RangeMapIgnoreValue
is set to zero.
When applying only an intrinsic calibration, it is recommended to create an organized (dense) point cloud with a confidence plane, which can be specified via the point cloud flags (as shown in the code snippet below). Background values are represented as non-confident points with values (x, y, z, confidence) = (0, 0, 0, 0). Valid points contain valid x, y, and z coordinates along with a confidence value of 1.
The following code snippet illustrates how to set the RangeMapIgnoreValue
and define the point cloud flags:
When applying an extrinsic calibration the resulting point cloud is un-organized (sparse). Thus a confidence plane should not be specified. All background values are excluded in this case.
It is essential to note that the calibration parameters stored in the calibrator always correspond to the entire sensor (without any pixel coordinate mirroring). If the camera's sensor settings specify a region of interest (ROI) or involve mirrored pixel coordinates, the range map values will be transformed to sensor coordinates before the calibration parameters are applied. Users of AT cameras, in particular, should exercise caution when configuring camera settings. In the AT or ZigZag calibration file the default sensor settings are stored.
The default sensor settings are stored in the respective calibration file and refer to:
If you acquire a range map using sensor settings that differ from the defaults stored in the calibrator, you must not use the standard function applying the calibration (see for C++, .NET, and Python)! Instead, use the advanced creation function, which allows you to specify the current sensor settings (see C++, .NET, and Python for details).
You can check the default sensor settings stored in the calibrator in C++, .NET, and Python. These settings, along with their purposes, are described below:
The table below lists the sensor settings along with their notations in the camera properties, the AT calibration file, and the ZigZag calibration file. Note that CVB currently supports sensor settings for AT cameras only.
Sensor Setting | AT Camera | Calibration File | ||
---|---|---|---|---|
C5 | C6 | AT (XML) | ZigZag (JSON) | |
Range Scale | has to be calculated from Cust::NumSubPixel | Std::Scan3dCoordinateScale | intrinsic.rangeScale | 3rd value of intrinsic.factors |
Pixel Position | Cust::AbsOffsetPos | Cust::Scan3dCoordinateMode | OffsetTop = 0 | intrinsic.sensorsettings.mode.absolutepositiony |
Pixels Mirrored | Std::ReverseX | not available | Width is negative | intrinsic.sensorsettings.mode.reverse.x |
Std::ReverseY | Cust::RegionReverseY | Height is negative | intrinsic.sensorsettings.mode.reverse.y | |
OffsetLeft (ROI) | Std::OffsetX | Std::OffsetX | intrinsic.sensorRoi | intrinsic.sensorsettings.sensorroi |
OffsetTop (ROI) | Cust::AoiOffsetY | Std::OffsetY | ||
Width (ROI) | Std::Width | Std::SensorWidth | ||
Height | Cust::AoiHeight | Std::SensorHeight | ||
Reduction Resolution | not available yet | intrinsic.rrH intrinsic.rrV | not supported yet | |
Encoder Step | not available | extrinsic.Sy | 2nd value of intrinsic.factors |
If further point cloud processing is needed, please refer to section 3D Point Cloud Processing.
In many cases a gapless rectified point cloud are required to enable 2D image processing. For further details, refer to the sections Rectification of Point Clouds and Filling Gaps in Range Maps. Please, be aware, the coordinate system of your calibrated point cloud is defined by the given reference coordinates. Since image coordinates follow a left-handed system, the point cloud to be rectified should also conform to a left-handed trihedron. For more information, see the section Recommendation for Point Cloud Rectification).