**Description** This function will filter the image by the adaptive DW-MTM filter method. This function works for only monochrome, 8 bit per pixel 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**

**Syntax** RetVal = [*BiFilter.*]**FilterAdaptiveDWMTM** hDib N Q C iShowProgress hWnd

**Returns RetVal ** LONGLONG The handle of new filtered DIB, 0 if an error occurred, or -1 if the BIFilter.dll does not installed.

**Remarks hDib ** LONGLONG Handle of the image to filter.

** N ** short 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.

** Q ** short 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.

** C ** short 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.

** iShowProgress ** short This parameter specifies the displaying of the progressbar and the preview dialog.

Available values:

**DISPLAY_NONE** (0) - The progressbar and the preview dialog will not display before filtering.

**DISPLAY_PROGRESS** (1) - The progressbar will display during filtering procedure.

**DISPLAY_DIALOG** (2) - The preview dialog will display before filtering. This dialog shows the part of the image before and after filtering.

**DISPLAY_BOTH** (3) - The progressbar and the preview dialog will display.

IMPORTANT: The preview dialog will only display, if there is BIDlgs32.dll installed.

** hWnd ** LONGLONG Handler of the parent window.

**See Also**