Skip to content

smooth_imageSmoothImageSmoothImagesmooth_imagesmooth_image๐Ÿ”—

Short description๐Ÿ”—

smooth_imageSmoothImageSmoothImagesmooth_imagesmooth_image โ€” Smooth an image using various filters.

Signature๐Ÿ”—

smooth_image( image Image, out image ImageSmooth, string Filter, real Alpha )void SmoothImage( const HObject& Image, HObject* ImageSmooth, const HTuple& Filter, const HTuple& Alpha )static void HOperatorSet.SmoothImage( HObject image, out HObject imageSmooth, HTuple filter, HTuple alpha )def smooth_image( image: HObject, filter: str, alpha: float ) -> HObject

Herror smooth_image( const Hobject Image, Hobject* ImageSmooth, const char* Filter, double Alpha )

Herror T_smooth_image( const Hobject Image, Hobject* ImageSmooth, const Htuple Filter, const Htuple Alpha )

HImage HImage::SmoothImage( const HString& Filter, double Alpha ) const

HImage HImage::SmoothImage( const char* Filter, double Alpha ) const

HImage HImage::SmoothImage( const wchar_t* Filter, double Alpha ) const (Windows only)

HImage HImage.SmoothImage( string filter, double alpha )

Description๐Ÿ”—

smooth_imageSmoothImage smooths gray images using recursive filters originally developed by Deriche and Shen and using the non-recursive Gaussian filter. The following filters can be chosen via the parameter Filterfilterfilter: โ€˜deriche1โ€™, โ€˜deriche2โ€™, โ€˜shenโ€™ and โ€˜gaussโ€™. The โ€œfilter widthโ€ (i.e., the range of the filter and thereby result of the filter) can be of any size. In the case that the Deriche or Shen is chosen it decreases by increasing the filter parameter Alphaalphaalpha and increases in the case of the Gauss filter (and Alphaalphaalpha corresponds to the standard deviation of the Gaussian function). An approximation of the appropriate size of the filter width Alphaalphaalpha is performed by the operator info_smoothInfoSmooth.

Non-recursive filters like the Gaussian filter are often implemented using filter-masks. In this case the runtime of the operator increases with increasing size of the filter mask. The runtime of the recursive filters remains constant; except the border treatment becomes a little bit more time consuming. The Gaussian filter becomes slow in comparison to the recursive ones but is in contrast to them isotropic (the filter โ€˜deriche2โ€™ is only weakly direction sensitive). A comparable result of the smoothing is achieved by choosing the following values for the parameter:

              Alpha(deriche2) = Alpha(deriche1) / 2,
              Alpha(shen)     = Alpha(deriche1) / 2,
              Alpha(gauss)    = 1.77 / Alpha(deriche1).

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

Attention๐Ÿ”—

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
  • 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 internal data level.

Parameters๐Ÿ”—

Imageimageimage (input_object) (multichannel-)image(-array) โ†’ object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject (byte / uint2 / real)

Image to be smoothed.

ImageSmoothimageSmoothimage_smooth (output_object) (multichannel-)image(-array) โ†’ object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject * (byte / uint2 / real)

Smoothed image.

Filterfilterfilter (input_control) string โ†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Filter.

Default: 'deriche2'"deriche2"
List of values: 'deriche1', 'deriche2', 'gauss', 'shen'"deriche1", "deriche2", "gauss", "shen"

Alphaalphaalpha (input_control) real โ†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Filter parameter: small values cause strong smoothing (vice versa by using 'gauss'"gauss").

Default: 0.50.5
Suggested values: 0.1, 0.2, 0.3, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 7.0, 10.00.1, 0.2, 0.3, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 7.0, 10.0
Minimum increment: 0.01
Recommended increment: 0.1
Restriction: Alpha > 0

Example๐Ÿ”—

(HDevelop)

info_smooth('deriche2',0.5,Size,Coeffs)
smooth_image(Input,Smooth,'deriche2',7)
(C)
info_smooth('deriche2',0.5,Size,Coeffs)\;
smooth_image(Input,&Smooth,'deriche2',7)\;

Result๐Ÿ”—

If the parameter values are correct the operator smooth_imageSmoothImage 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

Possible successors

thresholdThreshold, dyn_thresholdDynThreshold, regiongrowingRegiongrowing

Alternatives

binomial_filterBinomialFilter, gauss_filterGaussFilter, mean_imageMeanImage, derivate_gaussDerivateGauss, isotropic_diffusionIsotropicDiffusion

See also

info_smoothInfoSmooth, median_imageMedianImage, sigma_imageSigmaImage, anisotropic_diffusionAnisotropicDiffusion

References๐Ÿ”—

R.Deriche: โ€œFast Algorithms for Low-Level Visionโ€; IEEE Transactions on Pattern Analysis and Machine Intelligence; PAMI-12, no. 1; S. 78-87; 1990.

Module๐Ÿ”—

Foundation