Herror ::mean_sp (
    Hobject Image,
    Hobject *ImageSPMean,
    const HTuple &MaskWidth,
    const HTuple &MaskHeight,
    const HTuple &MinThresh,
    const HTuple &MaxThresh
)
HImage HImage::MeanSp (
    const HTuple &MaskWidth,
    const HTuple &MaskHeight,
    const HTuple &MinThresh,
    const HTuple &MaxThresh
) const
HImageArray HImageArray::MeanSp (
    const HTuple &MaskWidth,
    const HTuple &MaskHeight,
    const HTuple &MinThresh,
    const HTuple &MaxThresh
) const

Suppress salt and pepper noise.

The operator ::mean_sp carries out a smoothing by averaging the values. Only the gray values within the interval from MinThresh to MaxThresh 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_sp behaves like ::mean_image except for the running time.

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


Attention

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


Parameters

Image (input_object)
(multichannel-)image(-array) -> Hobject: HImage(Array) ( byte )
Input image.

ImageSPMean (output_object)
(multichannel-)image(-array) -> Hobject * : HImage(Array) ( byte )
Smoothed image.

MaskWidth (input_control)
extent.x -> HTuple.long
Width of filter mask.
Default value: 3
Suggested values: 3, 5, 7, 9, 11
Typical range of values: 3 <= MaskWidth <= 512 (lin)
Minimum increment: 2
Recommended increment: 2
Restriction: odd(MaskWidth)

MaskHeight (input_control)
extent.y -> HTuple.long
Height of filter mask.
Default value: 3
Suggested values: 3, 5, 7, 9, 11
Typical range of values: 3 <= MaskHeight <= 512 (lin)
Minimum increment: 2
Recommended increment: 2
Restriction: odd(MaskHeight)

MinThresh (input_control)
integer -> HTuple.long
Minimum gray value.
Default value: 1
Suggested values: 1, 5, 7, 9, 11, 15, 23, 31, 43, 61, 101
Typical range of values: 0 <= MinThresh <= 255 (lin)
Minimum increment: 1
Recommended increment: 1

MaxThresh (input_control)
integer -> HTuple.long
Maximum gray value.
Default value: 254
Suggested values: 5, 7, 9, 11, 15, 23, 31, 43, 61, 101, 200, 230, 250, 254
Typical range of values: 0 <= MaxThresh <= 255 (lin)
Minimum increment: 1
Recommended increment: 1
Restriction: MinThresh <= MaxThresh


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

Possible Successors

::disp_image


Alternatives

::mean_image, ::median_image, ::median_separate, ::eliminate_min_max


See also

::anisotrope_diff, ::sigma_image, ::gauss_image, ::smooth_image, ::eliminate_min_max


Module

Image filters



Copyright © 1996-2002 MVTec Software GmbH