median_separatemedian_separateMedianSeparateMedianSeparatemedian_separate (算子)

名称

median_separatemedian_separateMedianSeparateMedianSeparatemedian_separate — 使用矩形掩模进行分离中值滤波。

签名

median_separate(Image : ImageSMedian : MaskWidth, MaskHeight, Margin : )

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)

void MedianSeparate(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)

static void HOperatorSet.MedianSeparate(HObject image, out HObject imageSMedian, HTuple maskWidth, HTuple maskHeight, HTuple margin)

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

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

def median_separate(image: HObject, mask_width: int, mask_height: int, margin: Union[int, float, str]) -> HObject

描述

算子 median_separatemedian_separateMedianSeparateMedianSeparateMedianSeparatemedian_separate 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 MaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width followed by filtering with a vertical mask having the height MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_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.

算子 median_separatemedian_separateMedianSeparateMedianSeparateMedianSeparatemedian_separate is clearly faster than the normal operator median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image 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_separatemedian_separateMedianSeparateMedianSeparateMedianSeparatemedian_separate 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.

有关平滑滤波器概念的说明,请参阅 滤波器 / 平滑 一章的引言。

注意

请注意,若使用域缩减后的图像作为输入,滤波器算子可能会返回意外结果。请参阅 滤波器 一章

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

执行信息

参数

ImageImageImageImageimageimage (输入对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte / int2 / uint2 / int4 / real)

Image to be filtered.

ImageSMedianImageSMedianImageSMedianImageSMedianimageSMedianimage_smedian (输出对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject * (byte / int2 / uint2 / int4 / real)

Median filtered image.

MaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width (输入控制)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of rank mask.

默认值: 25

建议值: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27, 43, 51, 67, 91, 121, 151

值范围: 1 ≤ MaskWidth MaskWidth MaskWidth MaskWidth maskWidth mask_width ≤ 401

最小增量: 2

建议增量: 2

MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_height (输入控制)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of rank mask.

默认值: 25

建议值: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27, 43, 51, 67, 91, 121, 151

值范围: 1 ≤ MaskHeight MaskHeight MaskHeight MaskHeight maskHeight mask_height ≤ 401

最小增量: 2

建议增量: 2

MarginMarginMarginMarginmarginmargin (输入控制)  string HTupleUnion[int, float, str]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Border treatment.

默认值: 'mirrored' "mirrored" "mirrored" "mirrored" "mirrored" "mirrored"

建议值: 'mirrored'"mirrored""mirrored""mirrored""mirrored""mirrored", 'cyclic'"cyclic""cyclic""cyclic""cyclic""cyclic", 'continued'"continued""continued""continued""continued""continued", 0, 30, 60, 90, 120, 150, 180, 210, 240, 255

示例(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);

示例(HDevelop)

read_image(Image,'fabrik')
median_separate(Image,MedianSeparate,5,5,3)
dev_display(MedianSeparate)

示例(HDevelop)

read_image(Image,'fabrik')
median_separate(Image,MedianSeparate,5,5,3)
dev_display(MedianSeparate)

示例(HDevelop)

read_image(Image,'fabrik')
median_separate(Image,MedianSeparate,5,5,3)
dev_display(MedianSeparate)

复杂度

For each pixel: O(40).

可能的前趋

texture_lawstexture_lawsTextureLawsTextureLawsTextureLawstexture_laws, sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp, deviation_imagedeviation_imageDeviationImageDeviationImageDeviationImagedeviation_image

可能的后继

learn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNormLearnNdimNormlearn_ndim_norm, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, auto_thresholdauto_thresholdAutoThresholdAutoThresholdAutoThresholdauto_threshold

替代

median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image

另见

rank_imagerank_imageRankImageRankImageRankImagerank_image

参考文献

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

模块

基础