# Holes Extraction

This code snippet shows how to retrieve blobs’ holes.

## C++

```cpp
#include <eVision/EasyObject/EasyObject2/EImageEncoder.h>
```

```cpp
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// Image encoder
EImageEncoder encoder;
// Coded image
ECodedImage2 codedImage;
// ...
// Encode the image
encoder.Encode(srcImage, codedImage);
// Retrieve holes for all the blobs
for (unsigned int blobIndex = 0; blobIndex < codedImage.GetObjCount(); blobIndex++)
{
  ECodedElement blob = codedImage.GetObj(blobIndex);
  // Browse the holes of the current object
  for (unsigned int holeIndex = 0; holeIndex < blob.GetHoleCount(); holeIndex++)
  {
    // Retrieve a given hole
    ECodedElement hole = blob.GetHole(holeIndex);
  }
}
```

#### SEE ALSO
[`ECodedElement::GetHoleCount`](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ac74b4e254e3f543d70a330b3e09407d1) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#ad72a78e4c89d9c394b9f9a3e93814d21) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedElement.html#ada48f70209bce522d3458db057a0f55c), [`ECodedElement::GetHole`](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#acdb6e847cff1e6bd26c482d4a662736b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#af22e60a00a5ca3b205f554a6546de41c) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedElement.html#a4f16b366f943a0b7f12a56c5bbb88908), [`ECodedImage2::GetObjCount`](../../../../doxygen_cpp/classeVision_1_1ECodedImage2.html#a733b2c97ecfdbc362ff21d15a8f4774d) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedImage2.html#a90e81740c76fbebe8c0bbdf86a8ed005) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedImage2.html#a71e8726a8f124c588fe495f70d967a43), [`ECodedImage2::GetObj`](../../../../doxygen_cpp/classeVision_1_1ECodedImage2.html#a08b66335b3175ec30dac8772dfe2e2c6) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedImage2.html#ab64581176235009f4f9a2e8f984fc775) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedImage2.html#a574e95ffcedfeab265f39b5634202e9c)

## C#

```cs
using eVision;
```

```cs
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// Image encoder
EImageEncoder encoder = new EImageEncoder();
// Coded image
ECodedImage2 codedImage = new ECodedImage2();
// ...
// Encode the image
encoder.Encode(srcImage, codedImage);
// Retrieve holes for all the blobs
for (uint blobIndex = 0; blobIndex < codedImage.GetObjCount(); blobIndex++)
{
  ECodedElement blob = codedImage.GetObj(blobIndex);
  // Browse the holes of the current object
  for (uint holeIndex = 0; holeIndex < blob.HoleCount; holeIndex++)
  {
    // Retrieve a given hole
    ECodedElement hole = blob.GetHole(holeIndex);
  }
}
```

#### SEE ALSO
[`ECodedElement.HoleCount`](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#ad72a78e4c89d9c394b9f9a3e93814d21) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ac74b4e254e3f543d70a330b3e09407d1) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedElement.html#ada48f70209bce522d3458db057a0f55c), [`ECodedElement.GetHole`](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#af22e60a00a5ca3b205f554a6546de41c) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#acdb6e847cff1e6bd26c482d4a662736b) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedElement.html#a4f16b366f943a0b7f12a56c5bbb88908), [`ECodedImage2.GetObjCount`](../../../../doxygen_cs/classeVision_1_1ECodedImage2.html#a90e81740c76fbebe8c0bbdf86a8ed005) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedImage2.html#a733b2c97ecfdbc362ff21d15a8f4774d) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedImage2.html#a71e8726a8f124c588fe495f70d967a43), [`ECodedImage2.GetObj`](../../../../doxygen_cs/classeVision_1_1ECodedImage2.html#ab64581176235009f4f9a2e8f984fc775) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedImage2.html#a08b66335b3175ec30dac8772dfe2e2c6) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedImage2.html#a574e95ffcedfeab265f39b5634202e9c)

## Python

```py
import eVision
# Image constructor
src_image = eVision.EImageBW8()
# Image encoder
encoder = eVision.EImageEncoder()
# Coded image
codedImage = eVision.ECodedImage2()
# ...
# Encode the image
encoder.Encode(src_image, codedImage)
# Retrieve holes for all the blobs
for blobIndex in range(codedImage.GetObjCount()):
    blob = codedImage.GetObj(blobIndex)
    # Browse the holes of the current object
    for holeIndex in range(blob.HoleCount):
        # Retrieve a given hole
        hole = blob.GetHole(holeIndex)
```

#### SEE ALSO
[`ECodedElement.HoleCount`](../../../../doxygen_python/classeVision_1_1ECodedElement.html#ada48f70209bce522d3458db057a0f55c) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ac74b4e254e3f543d70a330b3e09407d1) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#ad72a78e4c89d9c394b9f9a3e93814d21), [`ECodedElement.GetHole`](../../../../doxygen_python/classeVision_1_1ECodedElement.html#a4f16b366f943a0b7f12a56c5bbb88908) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#acdb6e847cff1e6bd26c482d4a662736b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#af22e60a00a5ca3b205f554a6546de41c), [`ECodedImage2.GetObjCount`](../../../../doxygen_python/classeVision_1_1ECodedImage2.html#a71e8726a8f124c588fe495f70d967a43) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedImage2.html#a733b2c97ecfdbc362ff21d15a8f4774d) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedImage2.html#a90e81740c76fbebe8c0bbdf86a8ed005), [`ECodedImage2.GetObj`](../../../../doxygen_python/classeVision_1_1ECodedImage2.html#a574e95ffcedfeab265f39b5634202e9c) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedImage2.html#a08b66335b3175ec30dac8772dfe2e2c6) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedImage2.html#ab64581176235009f4f9a2e8f984fc775)
