Skip to content

mean_image_shapeMeanImageShapeMeanImageShapemean_image_shapemean_image_shape🔗

Short description🔗

mean_image_shapeMeanImageShapeMeanImageShapemean_image_shapemean_image_shape — Smooth image using a mean filter with arbitrary mask.

Signature🔗

mean_image_shape( image Image, region Mask, out image ImageMean )void MeanImageShape( const HObject& Image, const HObject& Mask, HObject* ImageMean )static void HOperatorSet.MeanImageShape( HObject image, HObject mask, out HObject imageMean )def mean_image_shape( image: HObject, mask: HObject ) -> HObject

Herror mean_image_shape( const Hobject Image, const Hobject Mask, Hobject* ImageMean )

Herror T_mean_image_shape( const Hobject Image, const Hobject Mask, Hobject* ImageMean )

HImage HImage::MeanImageShape( const HRegion& Mask ) const

HImage HImage.MeanImageShape( HRegion mask )

Description🔗

mean_image_shapeMeanImageShape performs a mean filter operation on the input image Imageimageimage with a mask that is specified by the region Maskmaskmask and returns the filtered image in ImageMeanimageMeanimage_mean. The shape of the mask can be chosen arbitrarily and can, for example, be created with operators like gen_circleGenCircle or draw_regionDrawRegion. The position of the mask does not influence the result since the center of gravity of the mask region is used as the reference point of the mask. For border treatment the gray values are reflected at the image edges.

For mean_image_shapeMeanImageShape special optimizations are implemented that use SIMD technology. The actual application of these special optimizations is controlled by the system parameter 'avx2_enable'"avx2_enable" (see set_systemSetSystem). If 'avx2_enable'"avx2_enable" is set to 'true'"true" (and the SIMD instruction set is available), the internal calculations are performed using SIMD technology. Furthermore, these optimizations are only used for byte images and if the area of the filter mask provided by Maskmaskmask is smaller than 129.

Note that mean_image_shapeMeanImageShape performs best on compact input regions.

At any rate, it is advantageous for the performance of mean_image_shapeMeanImageShape to choose the input region of Imageimageimage such that any border treatment is avoided.

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

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 filtered.

Maskmaskmask (input_object) region → objectHObjectHRegionHObjectHobject

Filter mask.

ImageMeanimageMeanimage_mean (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)

Filtered image.

Example🔗

(HDevelop)

read_image (Image, 'fabrik')
gen_circle (Circle, 10, 10, 2)
mean_image_shape (Image, Circle, ImageMean)
dev_display (ImageMean)

Result🔗

If the parameter values are correct the operator mean_image_shapeMeanImageShape 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, reduce_domainReduceDomain, rectangle1_domainRectangle1Domain, gen_circleGenCircle

Possible successors

dyn_thresholdDynThreshold, regiongrowingRegiongrowing

Alternatives

binomial_filterBinomialFilter, gauss_filterGaussFilter, smooth_imageSmoothImage, mean_imageMeanImage

See also

anisotropic_diffusionAnisotropicDiffusion, sigma_imageSigmaImage, convol_imageConvolImage, gen_lowpassGenLowpass

Module🔗

Foundation