# Contraharmonic Mean Filter

## Command

Image

Filters

Contraharmonic Mean Filter

## Description

Applies a contraharmonic mean filter to an image.

With a contraharmonic mean filter, the color value of each pixel is replaced with the contraharmonic mean of color values of the pixels in a surrounding region.

The contraharmonic mean with order Q is defined as:

A contraharmonic mean filter reduces or virtually eliminates the effects of salt-and-pepper noise. For positive values of Q, the filter eliminates pepper noise. For negative values of Q it eliminates salt noise. It cannot do both simultaneously.

Note that the contraharmonic filter is simply the arithmetic mean filter if Q = 0, and the harmonic mean filter if Q = −1.

A larger region (filter size) yields a stronger filter effect with the drawback of some blurring.

## Dialog box

**Filter Size**: larger filter yields stronger effect.

**Order**: the order Q of the filter.

Click Preview to judge the results.

Click OK to proceed.

## Examples

Before: | After (Q=1): | After (Q=-1): | ||