Skip to content

median_separateMedianSeparateMedianSeparatemedian_separatemedian_separateπŸ”—

Short descriptionπŸ”—

median_separateMedianSeparateMedianSeparatemedian_separatemedian_separate β€” Separated median filtering with rectangle masks.

SignatureπŸ”—

median_separate( image Image, out image ImageSMedian, extent.x MaskWidth, extent.y MaskHeight, string Margin )void MedianSeparate( const HObject& Image, HObject* ImageSMedian, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& Margin )static void HOperatorSet.MedianSeparate( HObject image, out HObject imageSMedian, HTuple maskWidth, HTuple maskHeight, HTuple margin )def median_separate( image: HObject, mask_width: int, mask_height: int, margin: Union[int, float, str] ) -> HObject

Herror median_separate( const Hobject Image, Hobject* ImageSMedian, const Hlong MaskWidth, const Hlong MaskHeight, const char* Margin )

Herror T_median_separate( const Hobject Image, Hobject* ImageSMedian, const Htuple MaskWidth, const Htuple MaskHeight, const Htuple Margin )

HImage HImage::MedianSeparate( Hlong MaskWidth, Hlong MaskHeight, const HTuple& Margin ) const

HImage HImage::MedianSeparate( Hlong MaskWidth, Hlong MaskHeight, const HString& Margin ) const

HImage HImage::MedianSeparate( Hlong MaskWidth, Hlong MaskHeight, const char* Margin ) const

HImage HImage::MedianSeparate( Hlong MaskWidth, Hlong MaskHeight, const wchar_t* Margin ) const (Windows only)

HImage HImage.MedianSeparate( int maskWidth, int maskHeight, HTuple margin )

HImage HImage.MedianSeparate( int maskWidth, int maskHeight, string margin )

DescriptionπŸ”—

The operator median_separateMedianSeparate carries out a variation of the median filtering: First two auxiliary images are created. The first one originates from a median filtering with a horizontal mask having a height of one pixel and the width MaskWidthmaskWidthmask_width followed by filtering with a vertical mask having the height MaskHeightmaskHeightmask_height and width of one pixel. The second auxiliary image is created by filtering with the same masks, but with a reversed sequence of the operation: first the vertical, then the horizontal mask. The output image results from averaging the two auxiliary images pixel by pixel.

The operator median_separateMedianSeparate is clearly faster than the normal operator median_imageMedianImage because both masks are one pixel wide, facilitating a very efficient processing. The runtime is practically independent of the size of the mask. For example, the operator median_separateMedianSeparate can be well used after texture filters, where large masks are needed.

The filter can also be used several times in a row in order to enhance the smoothing.

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.

Due to performance reasons, the input Imageimageimage is not checked whether it contains NaNs. Using an input image with NaNs crashes HALCON.

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

Image to be filtered.

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

Median filtered image.

MaskWidthmaskWidthmask_width (input_control) extent.x β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of rank mask.

Default: 2525
Suggested values: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27, 43, 51, 67, 91, 121, 1511, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27, 43, 51, 67, 91, 121, 151
Value range: 1 ≀ MaskWidth ≀ 401
Minimum increment: 2
Recommended increment: 2

MaskHeightmaskHeightmask_height (input_control) extent.y β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of rank mask.

Default: 2525
Suggested values: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27, 43, 51, 67, 91, 121, 1511, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27, 43, 51, 67, 91, 121, 151
Value range: 1 ≀ MaskHeight ≀ 401
Minimum increment: 2
Recommended increment: 2

Marginmarginmargin (input_control) string β†’ (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)Union[int, float, str]Htuple (char* / Hlong / double)

Border treatment.

Default: 'mirrored'"mirrored"
Suggested values: 'mirrored', 'cyclic', 'continued', 0, 30, 60, 90, 120, 150, 180, 210, 240, 255"mirrored", "cyclic", "continued", 0, 30, 60, 90, 120, 150, 180, 210, 240, 255

ExampleπŸ”—

(HDevelop)


read_image(Image,'fabrik')
median_separate(Image,MedianSeparate,5,5,3)
dev_display(MedianSeparate)
(C)
read_image(&Image,"fabrik")\;
median_separate(Image,&MedianSeparate,5,5,3)\;
disp_image(MedianSeparate,WindowHandle)\;

ComplexityπŸ”—

For each pixel: O(40).

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

texture_lawsTextureLaws, sobel_ampSobelAmp, deviation_imageDeviationImage

Possible successors

learn_ndim_normLearnNdimNorm, regiongrowingRegiongrowing, auto_thresholdAutoThreshold

Alternatives

median_imageMedianImage

See also

rank_imageRankImage

ReferencesπŸ”—

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

ModuleπŸ”—

Foundation