# Temporal Noise Reduction

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

## C++

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

```cpp
using namespace eVision;
// Images constructor
EImageBW16 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);
// Accumulation loop
int n;
for (n = 0; n < 10; n++)
{
  // Acquire a new image into noisyImage
  // ...

  // Add this new noisy image into the accumulator
  EasyImage::Oper(EArithmeticLogicOperation_Add, &noisyImage, &store, &store);
}
// Perform noise reduction
EasyImage::Oper(EArithmeticLogicOperation_Divide, &store, (EBW16)n, &cleanImage);
```

#### 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)

## C#

```cs
using eVision;
```

```cs
// Images constructor
EImageBW16 noisyImage = new EImageBW16();
EImageBW16 cleanImage = new EImageBW16();
// 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);
// Accumulation loop
int n;
for (n = 0; n < 10; n++)
{
  // Acquire a new image into noisyImage
  // ...

  // Add this new noisy image into the accumulator
  EasyImage.Oper(EArithmeticLogicOperation.Add, noisyImage, store, store);
}
// Perform noise reduction
bw16.Value = (byte)n;
EasyImage.Oper(EArithmeticLogicOperation.Divide, store, bw16, cleanImage);
```

#### 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)

## Python

```py
import eVision
# Images constructor
noisyImage = eVision.EImageBW16()
cleanImage = eVision.EImageBW16()
# 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)
# Accumulation loop
n = 0
for n in range(10):
    # Acquire a new image into noisyImage
    # ...

    # Add this new noisy image into the accumulator
    eVision.EasyImage.Oper(eVision.EArithmeticLogicOperation.Add, noisyImage, store, store)
# Perform noise reduction
bw16.Value = n
eVision.EasyImage.Oper(eVision.EArithmeticLogicOperation.Divide, store, bw16, cleanImage)
```

#### 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)
