Median Filtering

 

The FilterMedian function/method of the BiFilter DLL/OCX filters the image using a nonlinear median filter method, and is useful for removing noise from scanned or faxed images.

 

 

[C++]

 

/* Applying a median filter to an image*/

 

#include “BiFilter.h”

#include “BiImage.h”

 

HDIB hDibNew;

 

/* 1. parameter: Handle of the DIB to filter

   2. parameter: Size of the square mask

   3. parameter: Show progress

   4. parameter: Handle of parent window */

 

hDibNew = FilterMedian(hDib, 5, DISPLAY_BOTH,

AfxGetMainWnd()->m_hWnd);

 

if (!hDibNew)

{

            // Error

}

 

[C#]

 

/* Applying a median filter to an image*/

 

long hDibNew;

 

/* 1. parameter: Handle of the DIB to filter

   2. parameter: Size of the square mask

   3. parameter: Show progress

   4. parameter: Handle of parent window */

 

hDibNew = BiFilter.FilterMedian(hDib, 5, Convert.ToInt16(BIFILTERLib.enumDisplayModes.DispBoth),

Handle.ToInt64());

 

if (hDibNew == 0)

{

            // Error

}