mean_image_shapemean_image_shapeMeanImageShapeMeanImageShapemean_image_shape (Operator)

Name

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

Signature

mean_image_shape(Image, Mask : ImageMean : : )

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)

void MeanImageShape(const HObject& Image, const HObject& Mask, HObject* ImageMean)

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

static void HOperatorSet.MeanImageShape(HObject image, HObject mask, out HObject imageMean)

HImage HImage.MeanImageShape(HRegion mask)

def mean_image_shape(image: HObject, mask: HObject) -> HObject

Description

mean_image_shapemean_image_shapeMeanImageShapeMeanImageShapemean_image_shape performs a mean filter operation on the input image ImageImageImageimageimage with a mask that is specified by the region MaskMaskMaskmaskmask and returns the filtered image in ImageMeanImageMeanImageMeanimageMeanimage_mean. The shape of the mask can be chosen arbitrarily and can, for example, be created with operators like gen_circlegen_circleGenCircleGenCirclegen_circle or draw_regiondraw_regionDrawRegionDrawRegiondraw_region. 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_shapemean_image_shapeMeanImageShapeMeanImageShapemean_image_shape 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""avx2_enable""avx2_enable""avx2_enable" (see set_systemset_systemSetSystemSetSystemset_system). If 'avx2_enable'"avx2_enable""avx2_enable""avx2_enable""avx2_enable" is set to 'true'"true""true""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 MaskMaskMaskmaskmask is smaller than 129.

Note that mean_image_shapemean_image_shapeMeanImageShapeMeanImageShapemean_image_shape performs best on compact input regions.

At any rate, it is advantageous for the performance of mean_image_shapemean_image_shapeMeanImageShapeMeanImageShapemean_image_shape to choose the input region of ImageImageImageimageimage 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

Parameters

ImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject (byte / uint2 / real)

Image to be filtered.

MaskMaskMaskmaskmask (input_object)  region objectHRegionHObjectHObjectHobject

Filter mask.

ImageMeanImageMeanImageMeanimageMeanimage_mean (output_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject * (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_shapemean_image_shapeMeanImageShapeMeanImageShapemean_image_shape 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>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>). If necessary an exception is raised.

Possible Predecessors

read_imageread_imageReadImageReadImageread_image, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, rectangle1_domainrectangle1_domainRectangle1DomainRectangle1Domainrectangle1_domain, gen_circlegen_circleGenCircleGenCirclegen_circle

Possible Successors

dyn_thresholddyn_thresholdDynThresholdDynThresholddyn_threshold, regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing

Alternatives

binomial_filterbinomial_filterBinomialFilterBinomialFilterbinomial_filter, gauss_filtergauss_filterGaussFilterGaussFiltergauss_filter, smooth_imagesmooth_imageSmoothImageSmoothImagesmooth_image, mean_imagemean_imageMeanImageMeanImagemean_image

See also

anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion, sigma_imagesigma_imageSigmaImageSigmaImagesigma_image, convol_imageconvol_imageConvolImageConvolImageconvol_image, gen_lowpassgen_lowpassGenLowpassGenLowpassgen_lowpass

Module

Foundation