auto_thresholdauto_thresholdAutoThresholdAutoThresholdauto_threshold自动阈值(算子)

名称

auto_thresholdauto_thresholdAutoThresholdAutoThresholdauto_threshold — 使用从直方图确定的阈值对图像进行分割。

签名

auto_threshold(Image : Regions : Sigma : )

Herror auto_threshold(const Hobject Image, Hobject* Regions, double Sigma)

Herror T_auto_threshold(const Hobject Image, Hobject* Regions, const Htuple Sigma)

void AutoThreshold(const HObject& Image, HObject* Regions, const HTuple& Sigma)

HRegion HImage::AutoThreshold(const HTuple& Sigma) const

HRegion HImage::AutoThreshold(double Sigma) const

static void HOperatorSet.AutoThreshold(HObject image, out HObject regions, HTuple sigma)

HRegion HImage.AutoThreshold(HTuple sigma)

HRegion HImage.AutoThreshold(double sigma)

def auto_threshold(image: HObject, sigma: Union[int, float]) -> HObject

描述

auto_thresholdauto_thresholdAutoThresholdAutoThresholdAutoThresholdauto_threshold 通过多重阈值处理对单通道图像进行分割。首先确定灰度值的绝对直方图。随后从直方图中提取相关最小值,这些最小值将依次作为阈值操作的参数。对于 byte 图像,使用的阈值包括 0、255 以及从直方图中提取的所有最小值(在直方图经高斯滤波器平滑处理后,该滤波器的标准差为 SigmaSigmaSigmaSigmasigmasigma)。对于每个灰度值区间,都会生成一个区域。因此区域总数等于最小值个数加 1。对于 uint2 图像,上述流程可类比应用。但此时最高阈值为 65535。此外,uint2 图像中的 SigmaSigmaSigmaSigmasigmasigma 值(实质上)对应 256 级直方图,尽管内部实际使用更高分辨率的直方图。此操作旨在便于在不同图像类型间切换时无需更改参数 SigmaSigmaSigmaSigmasigmasigma。对于 float 图像,阈值即图像中的最小与最大灰度值,以及从直方图中提取的所有最小值。此处参数 SigmaSigmaSigmaSigmasigmasigma 的缩放比例基于图像原始灰度值。SigmaSigmaSigmaSigmasigmasigma 值设定越大,提取的区域越少。当待提取区域呈现相似灰度值(即均匀区域)时,该算子尤为有效。

执行信息

参数

ImageImageImageImageimageimage (输入对象)  singlechannelimage(-array) objectHImageHObjectHImageHobject (byte / uint2 / real)

输入图像。

RegionsRegionsRegionsRegionsregionsregions (输出对象)  region-array objectHRegionHObjectHRegionHobject *

灰度值处于自动确定区间内的区域。

SigmaSigmaSigmaSigmasigmasigma (输入控制)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

用于直方图高斯平滑的西格玛(Sigma)值。

默认值: 2.0

建议值: 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0

值范围: Sigma Sigma Sigma Sigma sigma sigma (lin)

最小增量: 0.01

建议增量: 0.3

示例(HDevelop)

read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)

示例(C)

read_image(&Image,"fabrik");
median_image(Image,&Median,"circle",3,"mirrored");
auto_threshold(Median,&Seg,2.0);
connection(Seg,&Connected);
set_colored(WindowHandle,12);
disp_obj(Connected,WindowHandle);

示例(HDevelop)

read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)

示例(HDevelop)

read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)

示例(HDevelop)

read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)

可能的前趋

anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image, illuminateilluminateIlluminateIlluminateIlluminateilluminate

可能的后继

connectionconnectionConnectionConnectionConnectionconnection, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, select_grayselect_graySelectGraySelectGraySelectGrayselect_gray

替代

binary_thresholdbinary_thresholdBinaryThresholdBinaryThresholdBinaryThresholdbinary_threshold, char_thresholdchar_thresholdCharThresholdCharThresholdCharThresholdchar_threshold

另见

gray_histogray_histoGrayHistoGrayHistoGrayHistogray_histo, gray_histo_absgray_histo_absGrayHistoAbsGrayHistoAbsGrayHistoAbsgray_histo_abs, histo_to_threshhisto_to_threshHistoToThreshHistoToThreshHistoToThreshhisto_to_thresh, smooth_funct_1d_gausssmooth_funct_1d_gaussSmoothFunct1dGaussSmoothFunct1dGaussSmoothFunct1dGausssmooth_funct_1d_gauss, thresholdthresholdThresholdThresholdThresholdthreshold

模块

基础