#include "BIFILTER.H"

HANDLE CALLBACK FilterAdaptiveDWMTM( HDIB hDIB,

int N,

int Q,

int C,

int iShowProgress,

HWND hParent)

**Description**

This function will filter the image by the adaptive DW-MTM filter method. This function works for only monochrome, 8 bit per bixel and 24 bit per pixel images. The adaptive double-window modified mean filter overcomes the difficulties of using MMSE filter in the presence of impulsive noise by using the median estimator to estimate the local mean. The adaptive DW-MTM filter is defined as follows : Given a pixel located at (x, y) coordinates, a median filter is computed within an N x N local region surrounding the location x, y. The median value computed from this filter is used to estimate the mean value of the N x N local area. Next, a larger-sized (Q x Q) matrix is used to calculate the mean value. In computing the mean value, only pixels within the graylevel range of

MED[g(x, y)] - C to MED[g(x, y)] + C

are used, eliminating any outliers from the mean calculation.

**Examples**

The original 256 x 256 pixel image corrupted by additive Gauss noise and the adaptive DW-MTM filtered image with N = 2, Q = 7 and C = 30 parameter values.

**Parameters**

HDIB |
hDIB |
Handle of the DIB to filter. |

int |
N |
This parameter specifies the size of the inner matrix where the median value is computed from. See the description and examples above for further information and a possible value. |

int |
Q |
This parameter specifies the size of the outer matrix where the mean value is computed from. See the description and examples above for further information and a possible value. |

int |
C |
This parameter specifies the value of parameter C mentioned in the definiton of adaptive DW-MTM filter above. See the description and examples above for further information and a possible value. |

int |
iShowProgress |
This parameter specifies the displaying of the progressbar and the preview dialog. Available values:
IMPORTANT: The preview dialog will only display, if there is BiDlgs.dll installed. |

HWND |
hParent |
Handler of the parent window. |

**Return values**

The handle of the new filtered DIB or NULL if an error occurred.

**Programming notes**

The function will not free the input DIB.

**Requirements**

Header : Declared in BIFilter.h; include BIFilter.h.

Library : Use BIFilter.lib.

DLLs : BIFilter.dll , BIDlgs32.dl.