# Easy3DPhotometricStereo

| Support            | ![](assets/images/sample_programs/applies_to/cpp.svg) ![](assets/images/sample_programs/applies_to/cs.svg)   |
|--------------------|--------------------------------------------------------------------------------------------------------------|
| Required licenses  | **Easy3D**                                                                                                   |
| Recommended images | Images from the folder `Sample Images/3D/PhotometricStereo`                                                  |
| Location           | `3D Processing/Easy3DPhotometricStereo`                                                                      |

## Purpose

This sample program demonstrates how to:

- Apply photometric stereo to several images to retrieve their albedo, gradients, curvatures or height map.

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

## Code highlights

Use the recommended images:

- Calibration: the 4 `calibration_*` files.
- Sample: either the 4 `object2_*` or the 4 `shoe_*` files.

1. Calibrate the imager from images of a sphere and retrieve a score.
   ```c++
   calibrationScore_ = photometricStereoImager_.CalibrateFromSphere(rois);
   ```
2. Compute the intermediary photometric stereo results from the images of the object.
   ```c++
   photometricStereoImager_.Compute(rois);
   ```
3. Compute the mean curvatures and retrieve them in an `EImageBW8` with high contrast.
   ```c++
   meanCurvHighContrast_ = photometricStereoImager_.ComputeMeanCurvatures(EPhotometricStereoContrast.HighContrast));
   ```
