# Using an ERegion

This code snippet shows how to compute statistics inside a region defined by an ERegion.

## C++

```cpp
#include <eVision/EasyImage/EImageStatisticsBW8.h>
```

```cpp
using namespace eVision;
// Images constructor
EImageBW8 srcImage;
ERegion mask;
// ...
// Compute the average value of the source image pixels
// corresponding to the mask do-care areas only
EImageStatisticsBW8 statistics;
statistics.SetImage(&srcImage, &mask);
float average = statistics.GetPixelAverage();
```

#### SEE ALSO
[`EImageStatisticsBW8::GetPixelAverage`](../../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#aad93fe63e7fd6096da43e17faaefe188) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#a9d8a0682304650af42717e3f4ae305d1) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a19ad9b2181a33cc50cd2af32367d30e2)

## C#

```cs
using eVision;
```

```cs
// Images constructor
EImageBW8 srcImage = new EImageBW8();
ERegion mask = new ERegion();
// ...
// Compute the average value of the source image pixels
// corresponding to the mask do-care areas only
EImageStatisticsBW8 statistics = new EImageStatisticsBW8();
statistics.SetImage(srcImage, mask);
float average = statistics.PixelAverage;
```

#### SEE ALSO
[`EImageStatisticsBW8.PixelAverage`](../../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#a9d8a0682304650af42717e3f4ae305d1) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#aad93fe63e7fd6096da43e17faaefe188) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a19ad9b2181a33cc50cd2af32367d30e2)

## Python

```py
import eVision
# Image constructors
src_image = eVision.EImageBW8()
mask = eVision.ERegion()
# ...
# Compute the average value of the source image pixels
# corresponding to the mask do-care areas only
statistics = eVision.EImageStatisticsBW8()
statistics.SetImage(src_image, mask)
average = statistics.PixelAverage
```

#### SEE ALSO
[`EImageStatisticsBW8.PixelAverage`](../../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a19ad9b2181a33cc50cd2af32367d30e2) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#aad93fe63e7fd6096da43e17faaefe188) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#a9d8a0682304650af42717e3f4ae305d1)
