min_max_filter ( Image : filteredImage : Xmask, Ymask, Gap, New : )

Smooth an image in the spatial domain to suppress noise.

min_max_filter smooths an image by replacing gray values with neighboring mean values, or local minima/maxima. In order to prevent edges and lines from being smoothed, only those gray values that represent local minima or maxima are replaced (if there is a line or edge within an image there will be at least one neighboruing pixel with a comparable gray value). Gap controls the strictness of replacment: Only gray values that exceed all other values within their local neighbourhood more than Gap and all values that fall below their neighbouring more than Gap are replaced: E(x,y) represents a NxM sized rectangular neighbourhood of an pixel at position (x,y), containing all pixels within the neighbourhood except the pixel itself;

if gray_value(x,y) >= Gap + maximum(E(x,y)) then replacement;
else if gray_value(x,y) + Gap <= minimum(E(x,y)) then replacement;
     else  adopt gray_value(x,y) without change;
New specifies how to perform the new value in case of a replacement.
New = 1  --> replace a local maximum with next minor local 
                        maximum and replace a local minimum with next 
                        bigger local minimum
New = 2  --> replace with mean value of all pixels within the 
                        local neighbourhood (including the replaced pixel)
New = 3  --> replace with median value of all pixels within the 
                        local neighbourhood (including the replaced pixel
                        (this is default and used if New has got 
                        any other value than 1 or 2)
Xmask and Ymask specifiy the width and height of the rectangular neighbourhood. Border treatment: Pixels outside the image border are not considered (e.g.: With a local 3x3-mask the neighbourhood of a pixel at (0,0) reduces to the pixels at (1,0),(0,1) and (1,1)).


Attention

min_max_filter only can work on byte images (HORUS image type BYTE_IMAGE). If Xmask or Ymask is an even number, it is replaced by the next higher odd number (this allows the unique extraction of the center of the filter mask). Width/height of the mask may not exceed the image width/height or be less than null.


Parameters

Image (input_object)
image -> object : byte
Image to smooth.

filteredImage (output_object)
image -> object : byte
Smoothed image.

Xmask (input_control)
extent.x -> integer
Width of filter mask.
Default value: 3
Suggested values: 3, 5, 7, 9
Range of values: 0 <= Xmask <= width(Image)

Ymask (input_control)
extent.y -> integer
Height of filter mask.
Default value: 3
Suggested values: 3, 5, 7, 9
Range of values: 0 <= Ymask <= height(Image)

Gap (input_control)
number -> real
Gap between local maximum/minimum and all other gray values of the neighbourhood.
Default value: 1.0
Suggested values: 1.0, 2.0, 5.0, 10.0

New (input_control)
integer -> integer
Replacement rule (1 = next minimum/maximum, 2 = average, 3 =median).
Default value: 3
List of values: 1, 2, 3


Result

min_max_filter returns TRUE if all parameters are correct. If the input is empty min_max_filter returns with an error message.


Possible Successors

out_of_focus, wiener_filter, wiener_filter_ni


See also

mean_sp, mean__, median, median_weighted, gauss__, smooth__


References

M. Imme:"A Noise Peak Elimination Filter"; S. 204-211 in CVGIP Graphical Models and Image Processing, Vol. 53, No. 2, March 1991

M. Lückenhaus:"Grundlagen des Wiener-Filters und seine Anwendung in der Bildanalyse"; Diplomarbeit; Technische Universität München, Institut für Informatik; Lehrstuhl Prof. Radig; 1995.



Copyright © 1996-1997 MVTec Software GmbH