eliminate_min_max
— Smooth an image in the spatial domain to suppress noise.
eliminate_min_max(Image : FilteredImage : MaskWidth, MaskHeight, Gap, Mode : )
eliminate_min_max
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 neighboring pixel with a comparable
gray value). Gap
controls the strictness of replacement: Only
gray values that exceed all other values within their local neighborhood
more than Gap
and all values that fall below their neighboring
more than Gap
are replaced.
Thus, with being the gray value at position and representing the gray values of a sized rectangular neighborhood of a pixel at position , containing all pixels within the neighborhood except the pixel itself, a pixel is replaced
if , or
else if .
Elsewise is adopted without change.
Mode
specifies how to perform the new value in case of a
replacement.
Mode
= 1:
replace a local maximum with next minor local maximum and
replace a local minimum with next bigger local minimum.
Mode
= 2:
replace with mean value of all pixels within the local neighborhood
(including the replaced pixel).
Mode
= 3:
replace with median value of all pixels within the local neighborhood
(including the replaced pixel (also used if Mode
has got
any other value than 1 or 2).
MaskWidth
and MaskHeight
specify the width and height of
the rectangular neighborhood.
Border treatment: Pixels outside the image border are not considered (e.g.,
with a local -mask the neighborhood of a pixel at
reduces to the pixels at ,
, and ).
For an explanation of the concept of smoothing filters see the introduction of chapter Filters / Smoothing.
eliminate_min_max
only can work on byte images (HALCON image
type BYTE_IMAGE). If MaskWidth
or MaskHeight
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.
Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.
Image
(input_object) (multichannel-)image(-array) →
object (byte / uint2)
Image to smooth.
FilteredImage
(output_object) (multichannel-)image(-array) →
object (byte / uint2)
Smoothed image.
MaskWidth
(input_control) extent.x →
(integer)
Width of filter mask.
Default: 3
Suggested values: 3, 5, 7, 9
Value range:
3
≤
MaskWidth
≤
width(Image)
Minimum increment: 2
Recommended increment: 2
Restriction:
odd(MaskWidth)
MaskHeight
(input_control) extent.y →
(integer)
Height of filter mask.
Default: 3
Suggested values: 3, 5, 7, 9
Value range:
3
≤
MaskHeight
≤
width(Image)
Minimum increment: 2
Recommended increment: 2
Restriction:
odd(MaskWidth)
Gap
(input_control) number →
(real)
Gap between local maximum/minimum and all other gray values of the neighborhood.
Default: 1.0
Suggested values: 1.0, 2.0, 5.0, 10.0
Mode
(input_control) integer →
(integer)
Replacement rule.
Default: 3
List of values: 1, 2, 3
eliminate_min_max
returns 2 (
H_MSG_TRUE)
if all parameters are
correct. If the input is empty eliminate_min_max
returns with
an error message.
wiener_filter
,
wiener_filter_ni
mean_sp
,
mean_image
,
median_image
,
median_weighted
,
binomial_filter
,
gauss_filter
,
smooth_image
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.
Foundation