Smoothing

List of Operators ↓

This chapter contains operators for smoothing filters. Further information about filtering can be found at the introduction to the chapter Filters.

General information about smoothing filters

Smoothing operators are filters that help to suppress noise in an image. For this purpose it is assumed, that in the undisturbed or true image the gray value of a given data point does not completely differ from its surroundings, ideally even varies only little. Thus, to suppress noise, it can be useful to replace the measured gray value with an estimate based on surrounding data points. Such an estimate can be done in different ways, so HALCON provides different smoothing operators.

The operators differ in speed and suitability for different kinds of noise. Information like the complexity (runtime dependence on the image size) is, if available, given in the operator reference. While most operators treat a single image, some can process depending images (e.g., multichannel filters like mean_nmean_nMeanNMeanNMeanNmean_n and rank_nrank_nRankNRankNRankNrank_n, or edge-preserving filters like guided_filterguided_filterGuidedFilterGuidedFilterGuidedFilterguided_filter and bilateral_filterbilateral_filterBilateralFilterBilateralFilterBilateralFilterbilateral_filter, which additionally use guidance images). Please note that some filters have both possibilities and more information is given in the specific operator reference.

Smoothing filters for single images with random noise

These smoothing filters apply their smoothing function on each channel of the input image separately and return a smoothed image with the same number of channels. In the following table we list implemented variants of smoothing filters for a single image with random noise and apply them for three different variants of random noise. The images in the table shall give an idea of the operators capability, but please note that the smoothed images highly depend on the input parameters and the individual image for every operator. For comparison, the different noisy images without filtering are given in the first row of the table. The undisturbed image without noise is shown in the following figure ((1) the full image as well as (2) its part by means of which possible effects on edges and remains from Salt & Pepper noise are visualized more clearly).

(1) (2)
(1) Undisturbed image, (2) part of the image chosen for the visualization of the filter capabilities

We marked filters recommended due to their special suitability concerning speed (S), edge-preservation (E), or a compromise between these two (C). The numbers in square brackets refer to further information that is given in a list below the table.

White Noise Gaussian Noise Salt & Pepper Noise Time[1] Alternatives
noisy image
binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter(S)
1|2 gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImagesmooth_image, derivate_gaussderivate_gaussDerivateGaussDerivateGaussDerivateGaussderivate_gauss, isotropic_diffusionisotropic_diffusionIsotropicDiffusionIsotropicDiffusionIsotropicDiffusionisotropic_diffusion
smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImagesmooth_image
2 | 9 binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter, gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, mean_imagemean_imageMeanImageMeanImageMeanImagemean_image, derivate_gaussderivate_gaussDerivateGaussDerivateGaussDerivateGaussderivate_gauss, isotropic_diffusionisotropic_diffusionIsotropicDiffusionIsotropicDiffusionIsotropicDiffusionisotropic_diffusion
mean_imagemean_imageMeanImageMeanImageMeanImagemean_image(S)
1 | 1 binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter, gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImagesmooth_image
anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion(E)[2]
805|2568 bilateral_filterbilateral_filterBilateralFilterBilateralFilterBilateralFilterbilateral_filter, guided_filterguided_filterGuidedFilterGuidedFilterGuidedFilterguided_filter
guided_filterguided_filterGuidedFilterGuidedFilterGuidedFilterguided_filter(E)[2,3]
13 | 62 bilateral_filterbilateral_filterBilateralFilterBilateralFilterBilateralFilterbilateral_filter, anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image
bilateral_filterbilateral_filterBilateralFilterBilateralFilterBilateralFilterbilateral_filter(E)[3]
16 | 54 guided_filterguided_filterGuidedFilterGuidedFilterGuidedFilterguided_filter, anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image
gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter
1 | 4 binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImagesmooth_image, derivate_gaussderivate_gaussDerivateGaussDerivateGaussDerivateGaussderivate_gauss, isotropic_diffusionisotropic_diffusionIsotropicDiffusionIsotropicDiffusionIsotropicDiffusionisotropic_diffusion
isotropic_diffusionisotropic_diffusionIsotropicDiffusionIsotropicDiffusionIsotropicDiffusionisotropic_diffusion(E)[2]
11 | 51
sigma_imagesigma_imageSigmaImageSigmaImageSigmaImagesigma_image
10 | 33 anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion, rank_imagerank_imageRankImageRankImageRankImagerank_image
midrange_imagemidrange_imageMidrangeImageMidrangeImageMidrangeImagemidrange_image
3 | 11 sigma_imagesigma_imageSigmaImageSigmaImageSigmaImagesigma_image
median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image(E)
3 | 4 median_rectmedian_rectMedianRectMedianRectMedianRectmedian_rect, rank_imagerank_imageRankImageRankImageRankImagerank_image, rank_rectrank_rectRankRectRankRectRankRectrank_rect
median_rectmedian_rectMedianRectMedianRectMedianRectmedian_rect(C)
2 | 3 median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image, rank_rectrank_rectRankRectRankRectRankRectrank_rect, rank_imagerank_imageRankImageRankImageRankImagerank_image
median_separatemedian_separateMedianSeparateMedianSeparateMedianSeparatemedian_separate(C)
7 | 24 median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image
median_weightedmedian_weightedMedianWeightedMedianWeightedMedianWeightedmedian_weighted
14 | 47 median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image, trimmed_meantrimmed_meanTrimmedMeanTrimmedMeanTrimmedMeantrimmed_mean, sigma_imagesigma_imageSigmaImageSigmaImageSigmaImagesigma_image
rank_rectrank_rectRankRectRankRectRankRectrank_rect(E)
2 | 8 rank_imagerank_imageRankImageRankImageRankImagerank_image, median_rectmedian_rectMedianRectMedianRectMedianRectmedian_rect, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image
rank_imagerank_imageRankImageRankImageRankImagerank_image(E)
3 | 15 rank_rectrank_rectRankRectRankRectRankRectrank_rect, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image, median_rectmedian_rectMedianRectMedianRectMedianRectmedian_rect
mean_spmean_spMeanSpMeanSpMeanSpmean_sp
4 | 9 mean_imagemean_imageMeanImageMeanImageMeanImagemean_image, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image, median_separatemedian_separateMedianSeparateMedianSeparateMedianSeparatemedian_separate, eliminate_min_maxeliminate_min_maxEliminateMinMaxEliminateMinMaxEliminateMinMaxeliminate_min_max
eliminate_min_maxeliminate_min_maxEliminateMinMaxEliminateMinMaxEliminateMinMaxeliminate_min_max