Skip to content

eliminate_min_maxEliminateMinMaxEliminateMinMaxeliminate_min_maxeliminate_min_max🔗

Short description🔗

eliminate_min_maxEliminateMinMaxEliminateMinMaxeliminate_min_maxeliminate_min_max — Smooth an image in the spatial domain to suppress noise.

Signature🔗

eliminate_min_max( image Image, out image FilteredImage, extent.x MaskWidth, extent.y MaskHeight, number Gap, integer Mode )void EliminateMinMax( const HObject& Image, HObject* FilteredImage, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& Gap, const HTuple& Mode )static void HOperatorSet.EliminateMinMax( HObject image, out HObject filteredImage, HTuple maskWidth, HTuple maskHeight, HTuple gap, HTuple mode )def eliminate_min_max( image: HObject, mask_width: int, mask_height: int, gap: float, mode: int ) -> HObject

Herror eliminate_min_max( const Hobject Image, Hobject* FilteredImage, const Hlong MaskWidth, const Hlong MaskHeight, double Gap, const Hlong Mode )

Herror T_eliminate_min_max( const Hobject Image, Hobject* FilteredImage, const Htuple MaskWidth, const Htuple MaskHeight, const Htuple Gap, const Htuple Mode )

HImage HImage::EliminateMinMax( Hlong MaskWidth, Hlong MaskHeight, double Gap, Hlong Mode ) const

HImage HImage.EliminateMinMax( int maskWidth, int maskHeight, double gap, int mode )

Description🔗

eliminate_min_maxEliminateMinMax 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). Gapgapgap controls the strictness of replacement: Only gray values that exceed all other values within their local neighborhood more than Gapgapgap and all values that fall below their neighboring more than Gapgapgap are replaced.

Thus, with \(g(x,y)\) being the gray value at position \((x,y)\) and \(E(x,y)\) representing the gray values of a \(\textrm{MaskWidth} \times \textrm{MaskHeight}\) sized rectangular neighborhood of a pixel at position \((x,y)\), containing all pixels within the neighborhood except the pixel itself, a pixel is replaced

  • if \(g(x,y) \ge \textrm{Gap} + max(E(x,y))\), or

  • else if \(g(x,y) + \textrm{Gap} <= min(E(x,y))\).

  • Elsewise \(g(x,y)\) is adopted without change.

Modemodemode specifies how to perform the new value in case of a replacement.

  • Modemodemode = 11: replace a local maximum with next minor local maximum and replace a local minimum with next bigger local minimum.

  • Modemodemode = 22: replace with mean value of all pixels within the local neighborhood (including the replaced pixel).

  • Modemodemode = 33: replace with median value of all pixels within the local neighborhood (including the replaced pixel (also used if Modemodemode has got any other value than 11 or 22).

MaskWidthmaskWidthmask_width and MaskHeightmaskHeightmask_height specify the width and height of the rectangular neighborhood. Border treatment: Pixels outside the image border are not considered (e.g., with a local \(3 \times 3\)-mask the neighborhood of a pixel at \((0,0)\) reduces to the pixels at \((1,0)\), \((0,1)\), and \((1,1)\)).

For an explanation of the concept of smoothing filters see the introduction of chapter Filters / Smoothing.

Attention🔗

If MaskWidthmaskWidthmask_width or MaskHeightmaskHeightmask_height 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.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

  • Automatically parallelized on channel level.

  • Automatically parallelized on domain level.

Parameters🔗

Imageimageimage (input_object) (multichannel-)image(-array) → object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Image to smooth.

FilteredImagefilteredImagefiltered_image (output_object) (multichannel-)image(-array) → object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject * (byte / uint2)

Smoothed image.

MaskWidthmaskWidthmask_width (input_control) extent.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of filter mask.

Default: 33
Suggested values: 3, 5, 7, 93, 5, 7, 9
Value range: 3 ≤ MaskWidth ≤ width(Image)
Minimum increment: 2
Recommended increment: 2
Restriction: odd(MaskWidth)

MaskHeightmaskHeightmask_height (input_control) extent.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of filter mask.

Default: 33
Suggested values: 3, 5, 7, 93, 5, 7, 9
Value range: 3 ≤ MaskHeight ≤ width(Image)
Minimum increment: 2
Recommended increment: 2
Restriction: odd(MaskWidth)

Gapgapgap (input_control) number → (real)HTuple (double)HTuple (double)floatHtuple (double)

Gap between local maximum/minimum and all other gray values of the neighborhood.

Default: 1.01.0
Suggested values: 1.0, 2.0, 5.0, 10.01.0, 2.0, 5.0, 10.0

Modemodemode (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Replacement rule.

Default: 33
List of values: 1, 2, 31, 2, 3

Result🔗

eliminate_min_maxEliminateMinMax returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty eliminate_min_maxEliminateMinMax returns with an error message.

Combinations with other operators🔗

Combinations

Possible successors

wiener_filterWienerFilter, wiener_filter_niWienerFilterNi

See also

mean_spMeanSp, mean_imageMeanImage, median_imageMedianImage, median_weightedMedianWeighted, binomial_filterBinomialFilter, gauss_filterGaussFilter, smooth_imageSmoothImage

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.

Module🔗

Foundation