Skip to content

gauss_filterGaussFilterGaussFiltergauss_filtergauss_filter🔗

Short description🔗

gauss_filterGaussFilterGaussFiltergauss_filtergauss_filter — Smooth using discrete Gauss functions.

Signature🔗

gauss_filter( image Image, out image ImageGauss, integer Size )void GaussFilter( const HObject& Image, HObject* ImageGauss, const HTuple& Size )static void HOperatorSet.GaussFilter( HObject image, out HObject imageGauss, HTuple size )def gauss_filter( image: HObject, size: int ) -> HObject

Herror gauss_filter( const Hobject Image, Hobject* ImageGauss, const Hlong Size )

Herror T_gauss_filter( const Hobject Image, Hobject* ImageGauss, const Htuple Size )

HImage HImage::GaussFilter( Hlong Size ) const

HImage HImage.GaussFilter( int size )

Description🔗

The operator gauss_filterGaussFilter smoothes images using the discrete Gaussian, a discrete approximation of the Gaussian function,

\[\begin{eqnarray*} G_{\sigma}\left(x\right) = \frac{1}{\sqrt{2\pi}\sigma}\exp \left(\frac{-x^{2}}{2\sigma^{2}}\right) \end{eqnarray*}\]

The smoothing effect increases with increasing filter size. The following filter sizes (Sizesizesize) are supported (the sigma value of the Gauss function is indicated in brackets):

  • 33 (0.600)

  • 55 (1.075)

  • 77 (1.550)

  • 99 (2.025)

  • 1111 (2.550)

For border treatment the gray values of the images are reflected at the image borders. Notice that, contrary to the operator gauss_imageGaussImage, the relationship between the filter mask size and its respective value for the sigma parameter is linear.

The operator binomial_filterBinomialFilter can be used as an alternative to gauss_filterGaussFilter. binomial_filterBinomialFilter is significantly faster than gauss_filterGaussFilter. It should be noted that the mask size in binomial_filterBinomialFilter does not lead to the same amount of smoothing as the mask size in gauss_filterGaussFilter. Corresponding mask sizes can be determined based on the respective values of the Gaussian smoothing parameter sigma.

gauss_filterGaussFilter can be executed on OpenCL devices for all supported image types. However, the OpenCL implementation can produce slightly different results from the scalar implementation.

For an explanation of the concept of smoothing filters see the introduction of chapter Filters / Smoothing.

Attention🔗

In order to be able to process gauss_filterGaussFilter on an OpenCL device, Imageimageimage must be at least 64 pixels in both width and height.

Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Execution information🔗

Execution information
  • Supports OpenCL compute devices.

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

  • Automatically parallelized on channel level.

  • Automatically parallelized on domain level.

Parameters🔗

Imageimageimage (input_object) (multichannel-)image(-array) → object (byte* / int2* / uint2* / int4* / real*)HObject (byte* / int2* / uint2* / int4* / real*)HImage (byte* / int2* / uint2* / int4* / real*)HObject (byte* / int2* / uint2* / int4* / real*)Hobject (byte* / int2* / uint2* / int4* / real*) *allowed for compute devices

Image to be smoothed.

ImageGaussimageGaussimage_gauss (output_object) (multichannel-)image(-array) → object (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)HImage (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)Hobject * (byte / int2 / uint2 / int4 / real)

Filtered image.

Sizesizesize (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Required filter size.

Default: 55
List of values: 3, 5, 7, 9, 113, 5, 7, 9, 11

Example🔗

(HDevelop)

gauss_filter(Input,Gauss,7)
regiongrowing(Gauss,Segments,7,7,5,100)
(C)
gauss_filter(Input,&Gauss,7,)\;
regiongrowing(Gauss,&Segments,7,7,5,100,)\;

Complexity🔗

For each pixel: \(O(Size * 2)\).

Result🔗

If the parameter values are correct the operator gauss_filterGaussFilter returns the value 2 (H_MSG_TRUE). The behavior in case of empty input (no input images available) is set via the operator set_system('no_object_result',<Result>). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

read_imageReadImage, grab_imageGrabImage

Possible successors

regiongrowingRegiongrowing, thresholdThreshold, sub_imageSubImage, dyn_thresholdDynThreshold, auto_thresholdAutoThreshold

Alternatives

binomial_filterBinomialFilter, smooth_imageSmoothImage, derivate_gaussDerivateGauss, isotropic_diffusionIsotropicDiffusion

See also

mean_imageMeanImage, anisotropic_diffusionAnisotropicDiffusion, sigma_imageSigmaImage, gen_lowpassGenLowpass

Module🔗

Foundation