# Easy3DLaserLineCalibration

| Support            | ![](assets/images/sample_programs/applies_to/cpp.svg)     |
|--------------------|-----------------------------------------------------------|
| Required licenses  | **Easy3DLaserLine**                                       |
| Recommended images | The images from the folder `Sample Images/3D/Calibration` |
| Location           | `3D Processing/Easy3DLaserLineCalibration`                |

## Purpose

This sample program demonstrates the 3 methods to calibrate a laser triangulation setup. The `Object Based Calibration` is the preferred method as it infers all the geometric parameters required for the generation of precise 3D data.

This sample program demonstrates how to:

- Compute and save the calibration model.
- Apply the calibration to a depth map.
- Save the resulting point cloud.

![](assets/images/sample_programs/3d_processing_easy3dlaserlinecalibration.webp)

## Code highlights

Use the recommended images:

- `ctx1 calibration object.png` is the scan of a calibration object.
- `ctx1 shapes.png` is a scan of the objects in the same configuration.

1. Set the parameters of an object `EObjectBasedCalibrationGenerator`, depending on the physical type and size of the scanned calibration object.
   ```c++
   calibrationGenerator_->SetCalibrationObjectType(calibrationObject_, calibrationSizeA_, calibrationSizeB_, calibrationSizeC_);
   calibrationGenerator_->SetPrecisionVsSpeedTradeOff(calibrationTradeOff_);
   ```
2. Compute a calibration model (`EObjectBasedCalibrationModel`) from a depth map.
   ```c++
   *calibrationModel_ = calibrationGenerator_->Compute(dm);
   ```
3. Use the previously computed calibration model to convert a scanned depth map to a metric point cloud.
   ```c++
   Easy3D::EDepthMapToPointCloudConverter converter;
   converter.SetCalibrationModel(*calibrationModel_);
   converter.Convert(sourceDepthMap_, destinationPointCloud_);
   ```
