# Computing Blobs Features

This code snippet shows how to retrieve blobs’ features.

## 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 source image
encoder.Encode(srcImage, codedImage);
for (unsigned int index = 0; index < codedImage.GetObjCount(); index++)
{
  // Retrieve the selected blob gravity center
  ECodedElement blob = codedImage.GetObj(index);
  float centerX = blob.GetGravityCenter().GetX();
  float centerY = blob.GetGravityCenter().GetY();
}
```

#### SEE ALSO
[`ECodedElement::GetGravityCenter`](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a66e421b1ce6588c1cf572d9da8939fa2) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#aecb5edc985078821d437178e8b85af24) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedElement.html#a6344670e34401f569da8ff77864fce44), [`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 source image
encoder.Encode(srcImage, codedImage);
for (uint index = 0; index < codedImage.GetObjCount(); index++)
{
  // Retrieve the selected blob gravity center
  ECodedElement blob = codedImage.GetObj(index);
  float centerX = blob.GravityCenter.X;
  float centerY = blob.GravityCenter.Y;
}
```

#### SEE ALSO
[`ECodedElement.GravityCenter`](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#aecb5edc985078821d437178e8b85af24) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a66e421b1ce6588c1cf572d9da8939fa2) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ECodedElement.html#a6344670e34401f569da8ff77864fce44), [`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 source image
encoder.Encode(src_image, codedImage)
for index in range(codedImage.GetObjCount()):
    # Retrieve the selected blob gravity center
    blob = codedImage.GetObj(index)
    centerX = blob.GravityCenter.X
    centerY = blob.GravityCenter.Y
```

#### SEE ALSO
[`ECodedElement.GravityCenter`](../../../../doxygen_python/classeVision_1_1ECodedElement.html#a6344670e34401f569da8ff77864fce44) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a66e421b1ce6588c1cf572d9da8939fa2) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ECodedElement.html#aecb5edc985078821d437178e8b85af24), [`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)
