Skip to content

median_weightedmedian_weightedMedianWeightedMedianWeightedmedian_weightedmedian_weightedπŸ”—

Short descriptionπŸ”—

median_weightedmedian_weightedMedianWeightedMedianWeightedmedian_weightedmedian_weighted β€” Weighted median filtering with different rank masks.

SignatureπŸ”—

median_weighted( image Image, out image ImageWMedian, string MaskType, integer MaskSize )median_weighted( Image : ImageWMedian : MaskType, MaskSize : )void MedianWeighted( const HObject& Image, HObject* ImageWMedian, const HTuple& MaskType, const HTuple& MaskSize )static void HOperatorSet.MedianWeighted( HObject image, out HObject imageWMedian, HTuple maskType, HTuple maskSize )def median_weighted( image: HObject, mask_type: str, mask_size: int ) -> HObject

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 )

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)

HImage HImage.MedianWeighted( string maskType, int maskSize )

DescriptionπŸ”—

The operator median_weightedMedianWeighted calculates the median of the gray values within a local environment. In contrast to median_imageMedianImage, which uses all gray values within the environment exactly once, the operator median_weightedMedianWeighted 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:

The operator median_weightedMedianWeighted means that, contrary to median_imageMedianImage, 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πŸ”—

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 / int2 / uint2)object (byte / int2 / uint2)HObject (byte / int2 / uint2)HImage (byte / int2 / uint2)HObject (byte / int2 / uint2)Hobject (byte / int2 / uint2)

Image to be filtered.

ImageWMedianimageWMedianimage_wmedian (output_object) (multichannel-)image(-array) β†’ object (byte / int2 / uint2)object (byte / int2 / uint2)HObject (byte / int2 / uint2)HImage (byte / int2 / uint2)HObject (byte / int2 / uint2)Hobject * (byte / int2 / uint2)

Median filtered image.

MaskTypemaskTypemask_type (input_control) string β†’ (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of median mask.

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

MaskSizemaskSizemask_size (input_control) integer β†’ (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

mask size.

Default: 33
List of values: 33

ExampleπŸ”—

(HDevelop)


read_image(Image,'fabrik')
median_weighted(Image,MedianWeighted,'gauss',3)
dev_display(MedianWeighted)
(C)
read_image(&Image,"fabrik")\;
median_weighted(Image,&MedianWeighted,"gauss",3)\;
disp_image(MedianWeighted,WindowHandle)\;

ComplexityπŸ”—

For each pixel: \(O(F * \log{F})\) with F = area of MaskTypemaskTypemask_type.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

read_imageReadImage

Possible successors

thresholdThreshold, dyn_thresholdDynThreshold, regiongrowingRegiongrowing

Alternatives

median_imageMedianImage, trimmed_meanTrimmedMean, sigma_imageSigmaImage

ReferencesπŸ”—

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

ModuleπŸ”—

Foundation