# Easy3DObjectExtract

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

## Purpose

This sample program demonstrates how to:

- Load an ZMap image.
- Set the X, Y and Z resolutions.
- Display the corresponding point cloud and the extracted 3D objects.

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

## Code highlights

1. Create a ZMap from the given image file.
   ```c++
   Zmap.LoadImage(fileName);
   ```
2. Set the resolution of the ZMap along the X, Y and Z axis.
   ```c++
   Zmap.SetResolution(rx, ry, rz);
   ```
3. Convert the ZMap to a point cloud.
   ```c++
   EPointCloud pc;
   EZMapToPointCloudConverter converter;
   converter.Convert(Zmap, pc);
   ```
4. Process the ZMap and extracts a list of 3D objects.
   ```c++
   E3DObjectExtractor extractor;
   extractor.Extract(Zmap);
   ```
5. Set how the `E3DObjectFeature` of all the registered `E3DObjects` should be rendered.
   ```c++
   viewer.SetFeatureStyleForAll3DObjects(renderStyle);
   ```
6. Set the `E3DObjectFeature` of all the registered `E3DObjects` to be rendered or hidden.
   ```c++
   viewer.ShowFeatureForAll3DObjects(objectFeature);
   viewer.HideFeatureForAll3DObjects(objectFeature);
   ```
