mean_spmean_spMeanSpMeanSp (Operator)

Name

mean_spmean_spMeanSpMeanSp — Suppress salt and pepper noise.

Signature

mean_sp(Image : ImageSPMean : MaskWidth, MaskHeight, MinThresh, MaxThresh : )

Herror mean_sp(const Hobject Image, Hobject* ImageSPMean, const Hlong MaskWidth, const Hlong MaskHeight, const Hlong MinThresh, const Hlong MaxThresh)

Herror T_mean_sp(const Hobject Image, Hobject* ImageSPMean, const Htuple MaskWidth, const Htuple MaskHeight, const Htuple MinThresh, const Htuple MaxThresh)

void MeanSp(const HObject& Image, HObject* ImageSPMean, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& MinThresh, const HTuple& MaxThresh)

HImage HImage::MeanSp(Hlong MaskWidth, Hlong MaskHeight, Hlong MinThresh, Hlong MaxThresh) const

static void HOperatorSet.MeanSp(HObject image, out HObject imageSPMean, HTuple maskWidth, HTuple maskHeight, HTuple minThresh, HTuple maxThresh)

HImage HImage.MeanSp(int maskWidth, int maskHeight, int minThresh, int maxThresh)

Description

The operator mean_spmean_spMeanSpMeanSpMeanSp carries out a smoothing by averaging the values. Only the gray values within the interval from MinThreshMinThreshMinThreshMinThreshminThresh to MaxThreshMaxThreshMaxThreshMaxThreshmaxThresh are averaged. Gray values which are too light or too dark are ignored during summation. If no gray value lies within the default interval during summation the original gray value is adopted. If the thresholds are set at 0 or 255, respectively, the operator mean_spmean_spMeanSpMeanSpMeanSp behaves like mean_imagemean_imageMeanImageMeanImageMeanImage except for the running time.

The operator mean_spmean_spMeanSpMeanSpMeanSp is used to suppress extreme gray values (salt and pepper noise = white and black dots).

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

Attention

If even values instead of odd values are given for MaskHeightMaskHeightMaskHeightMaskHeightmaskHeight or MaskWidthMaskWidthMaskWidthMaskWidthmaskWidth, the routine uses the next larger odd values instead (this way the center of the filter mask is always explicitly determined).

This operator may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Execution Information

Parameters

ImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHobject (byte / uint2)

Input image.

ImageSPMeanImageSPMeanImageSPMeanImageSPMeanimageSPMean (output_object)  (multichannel-)image(-array) objectHImageHImageHobject * (byte / uint2)

Smoothed image.

MaskWidthMaskWidthMaskWidthMaskWidthmaskWidth (input_control)  extent.x HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of filter mask.

Default value: 3

Suggested values: 3, 5, 7, 9, 11

Typical range of values: 3 ≤ MaskWidth MaskWidth MaskWidth MaskWidth maskWidth ≤ 512 (lin)

Minimum increment: 2

Recommended increment: 2

Restriction: odd(MaskWidth) && MaskWidth < width(Image) * 2

MaskHeightMaskHeightMaskHeightMaskHeightmaskHeight (input_control)  extent.y HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of filter mask.

Default value: 3

Suggested values: 3, 5, 7, 9, 11

Typical range of values: 3 ≤ MaskHeight MaskHeight MaskHeight MaskHeight maskHeight ≤ 512 (lin)

Minimum increment: 2

Recommended increment: 2

Restriction: odd(MaskHeight) && MaskHeight < height(Image) * 2

MinThreshMinThreshMinThreshMinThreshminThresh (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum gray value.

Default value: 1

Suggested values: 1, 5, 7, 9, 11, 15, 23, 31, 43, 61, 101

MaxThreshMaxThreshMaxThreshMaxThreshmaxThresh (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Maximum gray value.

Default value: 254

Suggested values: 5, 7, 9, 11, 15, 23, 31, 43, 61, 101, 200, 230, 250, 254

Restriction: MinThresh <= MaxThresh

Example (HDevelop)

read_image(Image,'mreut')
dev_display(Image)
mean_sp(Image,ImageMeansp,3,3,101,201)
dev_display(ImageMeansp)

Example (C)

read_image(&Image,"mreut");
disp_image(Image,WindowHandle);
mean_sp(Image,&ImageMeansp,3,3,101,201);
disp_image(ImageMeansp,WindowHandle);

Example (HDevelop)

read_image(Image,'mreut')
dev_display(Image)
mean_sp(Image,ImageMeansp,3,3,101,201)
dev_display(ImageMeansp)

Example (HDevelop)

read_image(Image,'mreut')
dev_display(Image)
mean_sp(Image,ImageMeansp,3,3,101,201)
dev_display(ImageMeansp)

Example (HDevelop)

read_image(Image,'mreut')
dev_display(Image)
mean_sp(Image,ImageMeansp,3,3,101,201)
dev_display(ImageMeansp)

Possible Successors

disp_imagedisp_imageDispImageDispImageDispImage

Alternatives

mean_imagemean_imageMeanImageMeanImageMeanImage, median_imagemedian_imageMedianImageMedianImageMedianImage, median_separatemedian_separateMedianSeparateMedianSeparateMedianSeparate, eliminate_min_maxeliminate_min_maxEliminateMinMaxEliminateMinMaxEliminateMinMax

See also

anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusion, sigma_imagesigma_imageSigmaImageSigmaImageSigmaImage, binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilter, gauss_filtergauss_filterGaussFilterGaussFilterGaussFilter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImage, eliminate_min_maxeliminate_min_maxEliminateMinMaxEliminateMinMaxEliminateMinMax

Module

Foundation