Operator Reference

median_weightedmedian_weightedMedianWeightedMedianWeightedmedian_weighted (Operator)

median_weightedmedian_weightedMedianWeightedMedianWeightedmedian_weighted — Weighted median filtering with different rank masks.

Signature

median_weighted(Image : ImageWMedian : MaskType, MaskSize : )

Herror median_weighted(const Hobject Image, Hobject* ImageWMedian, const char* MaskType, const Hlong MaskSize)

Herror T_median_weighted(const Hobject Image, Hobject* ImageWMedian, const Htuple MaskType, const Htuple MaskSize)

void MedianWeighted(const HObject& Image, HObject* ImageWMedian, const HTuple& MaskType, const HTuple& MaskSize)

HImage HImage::MedianWeighted(const HString& MaskType, Hlong MaskSize) const

HImage HImage::MedianWeighted(const char* MaskType, Hlong MaskSize) const

HImage HImage::MedianWeighted(const wchar_t* MaskType, Hlong MaskSize) const   ( Windows only)

static void HOperatorSet.MedianWeighted(HObject image, out HObject imageWMedian, HTuple maskType, HTuple maskSize)

HImage HImage.MedianWeighted(string maskType, int maskSize)

def median_weighted(image: HObject, mask_type: str, mask_size: int) -> HObject

Description

The operator median_weightedmedian_weightedMedianWeightedMedianWeightedmedian_weighted calculates the median of the gray values within a local environment. In contrast to median_imagemedian_imageMedianImageMedianImagemedian_image, which uses all gray values within the environment exactly once, the operator median_weightedmedian_weightedMedianWeightedMedianWeightedmedian_weighted weights all gray values several times depending on their position. A gray value is received into the field to be sorted several times according to its weighting. The following masks are available:

'gauss'

(MaskSizeMaskSizeMaskSizemaskSizemask_size = 3) 1 2 1 2 4 2 1 2 1

'inner'

(MaskSizeMaskSizeMaskSizemaskSizemask_size = 3) 1 1 1 1 3 1 1 1 1

The operator median_weightedmedian_weightedMedianWeightedMedianWeightedmedian_weighted means that, contrary to median_imagemedian_imageMedianImageMedianImagemedian_image, gray value corners remain.

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

Attention

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

  • 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

ImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject (byte / int2 / uint2)

Image to be filtered.

ImageWMedianImageWMedianImageWMedianimageWMedianimage_wmedian (output_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject * (byte / int2 / uint2)

Median filtered image.

MaskTypeMaskTypeMaskTypemaskTypemask_type (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of median mask.

Default: 'inner' "inner" "inner" "inner" "inner"

List of values: 'gauss'"gauss""gauss""gauss""gauss", 'inner'"inner""inner""inner""inner"

MaskSizeMaskSizeMaskSizemaskSizemask_size (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

mask size.

Default: 3

List of values: 3

Example (HDevelop)

read_image(Image,'fabrik')
median_weighted(Image,MedianWeighted,'gauss',3)
dev_display(MedianWeighted)

Example (C)

read_image(&Image,"fabrik");
median_weighted(Image,&MedianWeighted,"gauss",3);
disp_image(MedianWeighted,WindowHandle);

Example (HDevelop)

read_image(Image,'fabrik')
median_weighted(Image,MedianWeighted,'gauss',3)
dev_display(MedianWeighted)

Example (HDevelop)

read_image(Image,'fabrik')
median_weighted(Image,MedianWeighted,'gauss',3)
dev_display(MedianWeighted)

Complexity

For each pixel: O(F * log(F)) with F = area of MaskTypeMaskTypeMaskTypemaskTypemask_type.

Possible Predecessors

read_imageread_imageReadImageReadImageread_image

Possible Successors

thresholdthresholdThresholdThresholdthreshold, dyn_thresholddyn_thresholdDynThresholdDynThresholddyn_threshold, regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing

Alternatives

median_imagemedian_imageMedianImageMedianImagemedian_image, trimmed_meantrimmed_meanTrimmedMeanTrimmedMeantrimmed_mean, sigma_imagesigma_imageSigmaImageSigmaImagesigma_image

References

R. Haralick, L. Shapiro; “Computer and Robot Vision”; Addison-Wesley, 1992, Seite 319

Module

Foundation