mean_image ( Image : ImageMean : MaskWidth, MaskHeight : )

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 border treatment the gray values are reflected at the image edges.

For mean_image special optimizations are implemented that use SIMD technology. The actual application of these special optimizations is controlled by the system parameter 'mmx_available' (see set_system). If 'mmx_available' is set to 'true' (and the SIMD instruction set is available), the internal calculations are performed using SIMD technology. Note that SIMD technology performs best on large, compact input regions. Depending on the input region and the capabilities of the hardware the execution of mean_image might even take significantly more time with SIMD technology than without.

At any rate, it is advantageous for the performance of mean_image to choose the input region of Image such that any border treatment is avoided.


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

ImageMean (output_object)
(multichannel-)image(-array) -> object : byte / int2 / uint2 / int4 / real / dvf
Smoothed image.

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

MaskHeight (input_control)
extent.y -> integer
Height of filter mask.
Default value: 9
Suggested values: 3, 5, 7, 9, 11, 15, 23, 31, 43, 61, 101
Typical range of values: 1 <= 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 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>). If necessary an exception handling is raised.


Parallelization Information

mean_image is reentrant and automatically parallelized (on tuple level, channel level, domain level).


Possible Predecessors

reduce_domain, rectangle1_domain


Possible Successors

dyn_threshold, regiongrowing


Alternatives

gauss_image, smooth_image


See also

anisotropic_diffusion, sigma_image, convol_image, gen_lowpass


Module

Foundation



Copyright © 1996-2008 MVTec Software GmbH