Herror ::mean_image (
    Hobject Image,
    Hobject *ImageMean,
    const HTuple &MaskWidth,
    const HTuple &MaskHeight
)
HImage HImage::MeanImage (
    const HTuple &MaskWidth,
    const HTuple &MaskHeight
) const
HImageArray HImageArray::MeanImage (
    const HTuple &MaskWidth,
    const HTuple &MaskHeight
) const

Smooth by averaging.

The operator ::mean_image carries out a linear smoothing with the gray values of all input images (Image). The filter matrix consists of ones (evaluated equally) and has the size MaskHeight x MaskWidth. The result of the convolution is divided by MaskHeight x MaskWidth . For margin control the gray values are reflected at the image edges.


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 / int2 / int4 / real / dvf )
Image to be smoothed.

ImageMean (output_object)
(multichannel-)image(-array) -> Hobject * : HImage(Array) ( byte / int2 / int4 / real / dvf )
Smoothed image.

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

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


Example
read_image(&Image,"fabrik");
mean_image(Image,&Mean,3,3);
disp_image(Mean,WindowHandle);

Complexity

For each pixel: O(15).


Result

If the parameter values are correct the operator ::mean_image returns the value 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 handling is raised.


Possible Successors

::dyn_threshold, ::regiongrowing


Alternatives

::gauss_image, ::smooth_image


See also

::anisotrope_diff, ::sigma_image, ::convol_image, ::gen_lowpass


Module

Image filters



Copyright © 1996-2002 MVTec Software GmbH