Q: My image is noisy. How can I remove the noise from the image?
A: There are a lot of types of noises can corrupt the image for example: salt and pepper noise, Gaussian noise and blur noise. There are many filters implemented in BIFILTER.Dll which can solve this problem. Some of these filters give better results for salt and pepper noise (such as median filter), other ones give better results for Gaussian noise (such as adaptive filters). There can be no best or optimal filter definied. The best resulting filter always depends on the noise type, the image and the desired goals.
For black and white papers the morphological filtering functions can be applied to remove the undesired noises of faxing or scanning. For example: to remove thin lines and small noise regions, use the BinaryErosion function or BinaryOpening, to remove small bumps, and strenghten the lines use BinaryDilation or BinaryClosing. To remove noises corrupting color or higher bit level grayscale images, use the nonlinear, spatial and adaptive filter class. For example, to remove large outliers from images, use the FilterMedian function, for smaller outliers use the FilterMean function, for removing Gaussian noises use the adaptive filter class, etc. See the descriptions of the filters above in chapter Effects and Filters. It’s important to note that removing noise always reduces the quality of the image, for example smoothing the edges, etc. If the preview dialog is shown, the input parameters of the filtering can be changed onscreen, so the optimal properties of the filtering can be tuned.
Code example:
#include “BiFilter.h”
HANDLE hSourceDib = NULL;
// Load the input image
…
HDIB FilteredDIB = FilterMedian(hSourceDib, 5, DISPLAY_BOTH, AfxGetMainWnd()->m_hWnd);
// Further processing