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_shapeMeanImageShapeMeanImageShapeMeanImageShapemean_image_shape performs a mean filter operation on the input image ImageImageImageImageimageimage with a mask that is specified by the region MaskMaskMaskMaskmaskmask and returns the filtered image in ImageMeanImageMeanImageMeanImageMeanimageMeanimage_mean. The shape of the mask can be chosen arbitrarily and can, for example, be created with operators like gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle or draw_regiondraw_regionDrawRegionDrawRegionDrawRegiondraw_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_shapeMeanImageShapeMeanImageShapeMeanImageShapemean_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""avx2_enable" (see set_systemset_systemSetSystemSetSystemSetSystemset_system). If 'avx2_enable'"avx2_enable""avx2_enable""avx2_enable""avx2_enable""avx2_enable" is set to 'true'"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 MaskMaskMaskMaskmaskmask is smaller than 129.

Note that mean_image_shapemean_image_shapeMeanImageShapeMeanImageShapeMeanImageShapemean_image_shape performs best on compact input regions.

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

ImageImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte / uint2 / real)

Image to be filtered.

MaskMaskMaskMaskmaskmask (input_object)  region objectHRegionHObjectHRegionHobject

Filter mask.

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

Possible Predecessors

read_imageread_imageReadImageReadImageReadImageread_image, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, rectangle1_domainrectangle1_domainRectangle1DomainRectangle1DomainRectangle1Domainrectangle1_domain, gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle

Possible Successors

dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThresholddyn_threshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing

Alternatives

binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter, gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImagesmooth_image, mean_imagemean_imageMeanImageMeanImageMeanImagemean_image

See also

anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion, sigma_imagesigma_imageSigmaImageSigmaImageSigmaImagesigma_image, convol_imageconvol_imageConvolImageConvolImageConvolImageconvol_image, gen_lowpassgen_lowpassGenLowpassGenLowpassGenLowpassgen_lowpass

Module

Foundation