ClassesClasses | | Operators

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_nMeanNMeanNMeanN and rank_nrank_nRankNRankNRankN, or edge-preserving filters like guided_filterguided_filterGuidedFilterGuidedFilterGuidedFilter and bilateral_filterbilateral_filterBilateralFilterBilateralFilterBilateralFilter, 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_filterBinomialFilterBinomialFilterBinomialFilter(S)
1|2 gauss_filtergauss_filterGaussFilterGaussFilterGaussFilter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImage, derivate_gaussderivate_gaussDerivateGaussDerivateGaussDerivateGauss, isotropic_diffusionisotropic_diffusionIsotropicDiffusionIsotropicDiffusionIsotropicDiffusion

smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImage
2 | 9 binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilter, gauss_filtergauss_filterGaussFilterGaussFilterGaussFilter, mean_imagemean_imageMeanImageMeanImageMeanImage, derivate_gaussderivate_gaussDerivateGaussDerivateGaussDerivateGauss, isotropic_diffusionisotropic_diffusionIsotropicDiffusionIsotropicDiffusionIsotropicDiffusion

mean_imagemean_imageMeanImageMeanImageMeanImage(S)
1 | 1 binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilter, gauss_filtergauss_filterGaussFilterGaussFilterGaussFilter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImage

anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusion(E)[2]
805|2568 bilateral_filterbilateral_filterBilateralFilterBilateralFilterBilateralFilter, guided_filterguided_filterGuidedFilterGuidedFilterGuidedFilter

guided_filterguided_filterGuidedFilterGuidedFilterGuidedFilter(E)[2,3]
13 | 62 bilateral_filterbilateral_filterBilateralFilterBilateralFilterBilateralFilter, anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusion, median_imagemedian_imageMedianImageMedianImageMedianImage

bilateral_filterbilateral_filterBilateralFilterBilateralFilterBilateralFilter(E)[3]
16 | 54 guided_filterguided_filterGuidedFilterGuidedFilterGuidedFilter, anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusion, median_imagemedian_imageMedianImageMedianImageMedianImage

gauss_filtergauss_filterGaussFilterGaussFilterGaussFilter
1 | 4 binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImage, derivate_gaussderivate_gaussDerivateGaussDerivateGaussDerivateGauss, isotropic_diffusionisotropic_diffusionIsotropicDiffusionIsotropicDiffusionIsotropicDiffusion

isotropic_diffusionisotropic_diffusionIsotropicDiffusionIsotropicDiffusionIsotropicDiffusion(E)[2]
11 | 51

sigma_imagesigma_imageSigmaImageSigmaImageSigmaImage
10 | 33 anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusion, rank_imagerank_imageRankImageRankImageRankImage

midrange_imagemidrange_imageMidrangeImageMidrangeImageMidrangeImage
3 | 11 sigma_imagesigma_imageSigmaImageSigmaImageSigmaImage

median_imagemedian_imageMedianImageMedianImageMedianImage(E)
3 | 4 median_rectmedian_rectMedianRectMedianRectMedianRect, rank_imagerank_imageRankImageRankImageRankImage, rank_rectrank_rectRankRectRankRectRankRect

median_rectmedian_rectMedianRectMedianRectMedianRect(C)
2 | 3 median_imagemedian_imageMedianImageMedianImageMedianImage, rank_rectrank_rectRankRectRankRectRankRect, rank_imagerank_imageRankImageRankImageRankImage

median_separatemedian_separateMedianSeparateMedianSeparateMedianSeparate(C)
7 | 24 median_imagemedian_imageMedianImageMedianImageMedianImage

median_weightedmedian_weightedMedianWeightedMedianWeightedMedianWeighted
14 | 47 median_imagemedian_imageMedianImageMedianImageMedianImage, trimmed_meantrimmed_meanTrimmedMeanTrimmedMeanTrimmedMean, sigma_imagesigma_imageSigmaImageSigmaImageSigmaImage

rank_rectrank_rectRankRectRankRectRankRect(E)
2 | 8 rank_image, median_rect, median_imagerank_image, median_rect, median_imageRankImage, median_rect, median_imageRankImage, median_rect, median_imageRankImage, median_rect, median_image

rank_imagerank_imageRankImageRankImageRankImage(E)
3 | 15 rank_rectrank_rectRankRectRankRectRankRect, median_imagemedian_imageMedianImageMedianImageMedianImage, median_rectmedian_rectMedianRectMedianRectMedianRect

mean_spmean_spMeanSpMeanSpMeanSp
4 | 9 mean_imagemean_imageMeanImageMeanImageMeanImage, median_imagemedian_imageMedianImageMedianImageMedianImage, median_separatemedian_separateMedianSeparateMedianSeparateMedianSeparate, eliminate_min_maxeliminate_min_maxEliminateMinMaxEliminateMinMaxEliminateMinMax

eliminate_min_maxeliminate_min_maxEliminateMinMaxEliminateMinMaxEliminateMinMax
11 | 42

eliminate_speliminate_spEliminateSpEliminateSpEliminateSp
1 | 10 mean_spmean_spMeanSpMeanSpMeanSp, mean_imagemean_imageMeanImageMeanImageMeanImage, median_imagemedian_imageMedianImageMedianImageMedianImage, eliminate_min_maxeliminate_min_maxEliminateMinMaxEliminateMinMaxEliminateMinMax

trimmed_meantrimmed_meanTrimmedMeanTrimmedMeanTrimmedMean
7 | 29 sigma_imagesigma_imageSigmaImageSigmaImageSigmaImage, median_weightedmedian_weightedMedianWeightedMedianWeightedMedianWeighted, median_imagemedian_imageMedianImageMedianImageMedianImage
Further information related to the numbers in square brackets used in the table above:

  1. The numbers in the column 'Time' are indications about the time the operator uses to process an image. The numbers are obtained from averaging over multiple runs on the three different noise images and given in arbitrary units. Note also that the runtime of an operator depends on many factors, not at least on the used parameters and the image size. For each filter, the first number is for an image of size 800x600, the second for an image of size 1497x1160. The shown images are parts of the smaller image with parameters reasonable to us (we do not claim to have found the parameters resulting neither necessarily in the best image smoothing nor the smallest runtime). Even if two filters have the same parameter name as input, we did not necessarily use the same parameter value for both of them. Therefore, these numbers are to be understood as an indicator only.

  2. This operator can be used iteratively.

  3. This operator uses a guidance image (which can be the ImageImageImageImageimage itself).

Smoothing filters for single images with systematic noise

Video images composed of two half images can have systematic errors. In such a case, the operator fill_interlacefill_interlaceFillInterlaceFillInterlaceFillInterlace can help.

Operators designed for smoothing over multiple channels

These smoothing filters take an image with multiple channels as input and return a single channel (gray value) image. In HALCON, the following filters of this group are implemented:

Further operators

In addition to the smoothing filters, this chapter contains the following operator: info_smoothinfo_smoothInfoSmoothInfoSmoothInfoSmooth, which returns information related to the different filters used by the operator smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImage.

Glossary

In the following, the most important terms that are used in the context of smoothing filters are described:

smoothing

Smoothing means to apply a filter function on the given data to capture the main data patterns while removing noise.

random noise

Random noise is a stationary variation of brightness or color information by a small random amount for every pixel with an assumed mean of 0 over the total image.

systematic noise

Systematic noise is predictable noise, caused, e.g., by the specific setup used to acquire the images.


List of Operators

anisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion
Perform an anisotropic diffusion of an image.
bilateral_filterBilateralFilterBilateralFilterbilateral_filter
bilateral filtering of an image.
binomial_filterBinomialFilterBinomialFilterbinomial_filter
Smooth an image using the binomial filter.
eliminate_min_maxEliminateMinMaxEliminateMinMaxeliminate_min_max
Smooth an image in the spatial domain to suppress noise.
eliminate_spEliminateSpEliminateSpeliminate_sp
Replace values outside of thresholds with average value.
fill_interlaceFillInterlaceFillInterlacefill_interlace
Interpolate 2 video half images.
gauss_filterGaussFilterGaussFiltergauss_filter
Smooth using discrete gauss functions.
guided_filterGuidedFilterGuidedFilterguided_filter
Guided filtering of an image.
info_smoothInfoSmoothInfoSmoothinfo_smooth
Information on smoothing filter smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImage.
isotropic_diffusionIsotropicDiffusionIsotropicDiffusionisotropic_diffusion
Perform an isotropic diffusion of an image.
mean_imageMeanImageMeanImagemean_image
Smooth by averaging.
mean_nMeanNMeanNmean_n
Average gray values over several channels.
mean_spMeanSpMeanSpmean_sp
Suppress salt and pepper noise.
median_imageMedianImageMedianImagemedian_image
Compute a median filter with various masks.
median_rectMedianRectMedianRectmedian_rect
Compute a median filter with rectangular masks.
median_separateMedianSeparateMedianSeparatemedian_separate
Separated median filtering with rectangle masks.
median_weightedMedianWeightedMedianWeightedmedian_weighted
Weighted median filtering with different rank masks.
midrange_imageMidrangeImageMidrangeImagemidrange_image
Calculate the average of maximum and minimum inside any mask.
rank_imageRankImageRankImagerank_image
Compute a rank filter with arbitrary masks.
rank_nRankNRankNrank_n
Return gray values with given rank from multiple channels.
rank_rectRankRectRankRectrank_rect
Compute a rank filter with rectangular masks.
sigma_imageSigmaImageSigmaImagesigma_image
Non-linear smoothing with the sigma filter.
smooth_imageSmoothImageSmoothImagesmooth_image
Smooth an image using various filters.
trimmed_meanTrimmedMeanTrimmedMeantrimmed_mean
Smooth an image with an arbitrary rank mask.

ClassesClasses | | Operators