# Recursive Average

This code snippet shows how to perform noise reduction by recursive averaging.

## C++

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

```cpp
using namespace eVision;
// Images constructor
EImageBW8 noisyImage, cleanImage;
// 16 bits work image used as an accumulator
EImageBW16 store;
// ...
// All images must have the same size
cleanImage.SetSize(&noisyImage);
store.SetSize(&noisyImage);
// Clear the accumulator image
EasyImage::Oper(EArithmeticLogicOperation_Copy, (EBW16)0, &store);
// Prepare the transfer lookup table (reduction factor = 3)
EBW16Vector lut;
EasyImage::SetRecursiveAverageLUT(&lut, 3.f);
// Perform the noise reduction
EasyImage::RecursiveAverage(&noisyImage, &store, &cleanImage, &lut);
```

#### SEE ALSO
[`EasyImage::Oper`](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#adf314c42c92233ca337668250125375e) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#afcbccbf75626021b9a80ae1f9978eac4) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#ad2662856c57834c7b067d0b4a957d097), [`EasyImage::SetRecursiveAverageLUT`](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#ad1945a53c397eb84a583eaad63b975ae) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a9f55d1b5b16260c4cd0efebf5bddf038) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a49fb1ca51befb1c6580c6eb990a57261), [`EasyImage::RecursiveAverage`](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a6fa21bcc4e69362d4783a3a1c3760ea3) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a605ca77f9688330baf5d75098f2e0f32) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a8da446df8c256d9b792f9465479ece2c)

## C#

```cs
using eVision;
```

```cs
// Images constructor
EImageBW8 noisyImage = new EImageBW8();
EImageBW8 cleanImage = new EImageBW8();
// 16 bits work image used as an accumulator
EImageBW16 store = new EImageBW16();
// ...
// All images must have the same size
cleanImage.SetSize(noisyImage);
store.SetSize(noisyImage);
// Clear the accumulator image
EBW16 bw16 = new EBW16(0);
EasyImage.Oper(EArithmeticLogicOperation.Copy, bw16, store);
// Prepare the transfer lookup table (reduction factor = 3)
EBW16Vector lut = new EBW16Vector();
EasyImage.SetRecursiveAverageLUT(lut, 3.0f);
// Perform the noise reduction
EasyImage.RecursiveAverage(noisyImage, store, cleanImage, lut);
```

#### SEE ALSO
[`EasyImage.Oper`](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#afcbccbf75626021b9a80ae1f9978eac4) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#adf314c42c92233ca337668250125375e) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#ad2662856c57834c7b067d0b4a957d097), [`EasyImage.SetRecursiveAverageLUT`](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a9f55d1b5b16260c4cd0efebf5bddf038) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#ad1945a53c397eb84a583eaad63b975ae) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a49fb1ca51befb1c6580c6eb990a57261), [`EasyImage.RecursiveAverage`](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a605ca77f9688330baf5d75098f2e0f32) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a6fa21bcc4e69362d4783a3a1c3760ea3) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a8da446df8c256d9b792f9465479ece2c)

## Python

```py
import eVision
# Images constructor
noisyImage = eVision.EImageBW8()
cleanImage = eVision.EImageBW8()
# 16 bits work image used as an accumulator
store = eVision.EImageBW16()
# ...
# All images must have the same size
cleanImage.SetSize(noisyImage)
store.SetSize(noisyImage)
# Clear the accumulator image
bw16 = eVision.EBW16(0)
eVision.EasyImage.Oper(eVision.EArithmeticLogicOperation.Copy, bw16, store)
# Prepare the transfer lookup table (reduction factor = 3)
lut = eVision.EBW16Vector()
eVision.EasyImage.SetRecursiveAverageLUT(lut, 3.0)
# Perform the noise reduction
eVision.EasyImage.RecursiveAverage(noisyImage, store, cleanImage, lut)
```

#### SEE ALSO
[`EasyImage.Oper`](../../../../../doxygen_python/classeVision_1_1EasyImage.html#ad2662856c57834c7b067d0b4a957d097) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#adf314c42c92233ca337668250125375e) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#afcbccbf75626021b9a80ae1f9978eac4), [`EasyImage.SetRecursiveAverageLUT`](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a49fb1ca51befb1c6580c6eb990a57261) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#ad1945a53c397eb84a583eaad63b975ae) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a9f55d1b5b16260c4cd0efebf5bddf038), [`EasyImage.RecursiveAverage`](../../../../../doxygen_python/classeVision_1_1EasyImage.html#a8da446df8c256d9b792f9465479ece2c) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyImage.html#a6fa21bcc4e69362d4783a3a1c3760ea3) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyImage.html#a605ca77f9688330baf5d75098f2e0f32)
