| MIL 10 User Guide
| Customize Help

Averaging an input sequence



See also
Availability
Available in MIL-Lite

Available in MIL

An effective technique to remove random noise is to average a grabbed sequence of the same target image. For instance, Gaussian noise affects the value of any given pixel for each grabbed frame, adding to or subtracting from the actual pixel value. Therefore, over several image acquisitions, this noise averages out to zero. As a rule of thumb, the standard deviation of the noise is reduced by a factor roughly equal to the square root of the number of averaged frames. In other words, the signal-to-noise ratio increases as the square root of the number of frames increases.

With MIL, you can average an input sequence, using either one of the following operations:

  • Adding all input frames and then dividing the result by a specified weight factor. To specify this operation, use MimArith().

  • Adding weighted input frames to a weighted accumulator buffer ((Iacc = aIin + (1 - a)Iacc) or (Iacc = a(Iin - Iacc) + Iacc)). To specify this operation, use MimArithMultiple() with M_WEIGHTED_AVERAGE.

The latter approach also acts as a temporal filter if the input is changing. This allows you to filter out moving objects from a constant background.

To not lose any frames in your sequence, you can use a technique called multiple buffering, where you can grab data into one buffer while other buffers are processed. For more information, see the Multiple buffering subsection of the Grabbing and processing section of Chapter 23: Grabbing with your digitizer, and for an example on how to implement multiple buffering, see the MdigProcess.cpp file in MIL's example directory.