dyn_threshold dyn_threshold DynThreshold DynThreshold dyn_threshold 动态阈值(算子)
名称
dyn_threshold dyn_threshold DynThreshold DynThreshold dyn_threshold — 使用局部阈值分割图像。
签名
void DynThreshold (const HObject& OrigImage , const HObject& ThresholdImage , HObject* RegionDynThresh , const HTuple& Offset , const HTuple& LightDark )
HRegion HImage ::DynThreshold (const HImage& ThresholdImage , const HTuple& Offset , const HString& LightDark ) const
HRegion HImage ::DynThreshold (const HImage& ThresholdImage , double Offset , const HString& LightDark ) const
HRegion HImage ::DynThreshold (const HImage& ThresholdImage , double Offset , const char* LightDark ) const
HRegion HImage ::DynThreshold (const HImage& ThresholdImage , double Offset , const wchar_t* LightDark ) const
(
Windows only)
描述
dyn_threshold dyn_threshold DynThreshold DynThreshold DynThreshold dyn_threshold 从输入图像中选取满足阈值条件的像素区域。设 g_{o} = g_{OrigImage OrigImage OrigImage OrigImage origImage orig_image },g_{t} =
g_{ThresholdImage ThresholdImage ThresholdImage ThresholdImage thresholdImage threshold_image }。当
LightDark LightDark LightDark LightDark lightDark light_dark = 'light' "light" "light" "light" "light" "light" 时,条件为:
当 LightDark LightDark LightDark LightDark lightDark light_dark = 'dark' "dark" "dark" "dark" "dark" "dark" 时,条件为:
当 LightDark LightDark LightDark LightDark lightDark light_dark = 'equal' "equal" "equal" "equal" "equal" "equal" 时,条件为:
最后,当 LightDark LightDark LightDark LightDark lightDark light_dark = 'not_equal' "not_equal" "not_equal" "not_equal" "not_equal" "not_equal" 时,条件为:
通常,阈值图像会对原始图像进行平滑处理(例如通过应用 mean_image mean_image MeanImage MeanImage MeanImage mean_image 、binomial_filter binomial_filter BinomialFilter BinomialFilter BinomialFilter binomial_filter 、gauss_filter gauss_filter GaussFilter GaussFilter GaussFilter gauss_filter 等滤波器)。此时 dyn_threshold dyn_threshold DynThreshold DynThreshold DynThreshold dyn_threshold 的效果类似于对经过高通滤波的原始图像应用
threshold threshold Threshold Threshold Threshold threshold 阈值处理(参见 highpass_image highpass_image HighpassImage HighpassImage HighpassImage highpass_image )。
通过 dyn_threshold dyn_threshold DynThreshold DynThreshold DynThreshold dyn_threshold ,可提取对象的轮廓,其中对象的尺寸(直径)由低通滤波器的掩模尺寸决定,而对象边缘的幅度则由其边缘特征决定:
选择的掩模尺寸越大,检测到的区域就越大。经验法则是掩模尺寸应约为待提取对象直径的两倍。切勿将 Offset Offset Offset Offset offset offset 参数设为零,否则会检测到过多微小区域(即噪声)。取值范围在 5 至 40 之间较为实用。选择较大的 Offset Offset Offset Offset offset offset 值时,提取的区域会相应变小。
输入图像中满足上述条件的全部像素点将被共同存储于一个区域内。如有需要,可通过调用 connection connection Connection Connection Connection connection 获取连通分量。
注意
如果 Offset Offset Offset Offset offset offset 选取范围在 -1 到 1 之间,通常会生成噪声很强的区域,需要大量存储空间。如果 Offset Offset Offset Offset offset offset 选取过大(例如> 60),则可能出现所有点都不满足阈值条件的情况(即返回空区域)。如果 Offset Offset Offset Offset offset offset 选取过小(例如< -60),则可能出现所有点都满足阈值条件的情况(即返回完整区域)。
执行信息
多线程类型:可重入(与非独占算子并行运行)。
多线程作用域:全局(可从任何线程调用)。
在元组级别上自动并行化。
在域级别上自动并行化。
参数
OrigImage OrigImage OrigImage OrigImage origImage orig_image (输入对象) singlechannelimage(-array) → object HImage HObject HImage Hobject (byte / int2 / uint2 / int4 / real)
输入图像。
ThresholdImage ThresholdImage ThresholdImage ThresholdImage thresholdImage threshold_image (输入对象) singlechannelimage(-array) → object HImage HObject HImage Hobject (byte / int2 / uint2 / int4 / real)
包含局部阈值的图像。
RegionDynThresh RegionDynThresh RegionDynThresh RegionDynThresh regionDynThresh region_dyn_thresh (输出对象) region(-array) → object HRegion HObject HRegion Hobject *
分割区域。
Offset Offset Offset Offset offset offset (输入控制) number → HTuple Union[int, float] HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
应用于阈值图像的偏移量。
默认值:
5.0
建议值:
1.0, 3.0, 5.0, 7.0, 10.0, 20.0, 30.0
值范围:
-255.0
≤
Offset
Offset
Offset
Offset
offset
offset
≤
255.0 (lin)
最小增量:
0.01
建议增量:
5
LightDark LightDark LightDark LightDark lightDark light_dark (输入控制) string → HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
提取亮部、暗部或相似区域?
默认值:
'light'
"light"
"light"
"light"
"light"
"light"
值列表:
'dark' "dark" "dark" "dark" "dark" "dark" , 'equal' "equal" "equal" "equal" "equal" "equal" , 'light' "light" "light" "light" "light" "light" , 'not_equal' "not_equal" "not_equal" "not_equal" "not_equal" "not_equal"
示例(HDevelop)
* Looking for regions with the diameter D
mean_image(Image,Mean,D*2+1,D*2+1)
dyn_threshold(Image,Mean,Seg,5,'light')
connection(Seg,Regions)
示例(C)
/* Looking for regions with the diameter D */
mean_image(Image,&Mean,D*2+1,D*2+1);
dyn_threshold(Image,Mean,&Seg,5.0,"light");
connection(Seg,&Region);
示例(HDevelop)
* Looking for regions with the diameter D
mean_image(Image,Mean,D*2+1,D*2+1)
dyn_threshold(Image,Mean,Seg,5,'light')
connection(Seg,Regions)
示例(HDevelop)
* Looking for regions with the diameter D
mean_image(Image,Mean,D*2+1,D*2+1)
dyn_threshold(Image,Mean,Seg,5,'light')
connection(Seg,Regions)
示例(HDevelop)
* Looking for regions with the diameter D
mean_image(Image,Mean,D*2+1,D*2+1)
dyn_threshold(Image,Mean,Seg,5,'light')
connection(Seg,Regions)
复杂度
设 A 为输入区域的面积。则运行时间复杂度为 O(A)。
结果
dyn_threshold dyn_threshold DynThreshold DynThreshold DynThreshold dyn_threshold 在所有参数正确时返回 2 (H_MSG_TRUE )。通过 set_system set_system SetSystem SetSystem SetSystem set_system 算子设置标志 'no_object_result' "no_object_result" "no_object_result" "no_object_result" "no_object_result" "no_object_result" 、'empty_region_result' "empty_region_result" "empty_region_result" "empty_region_result" "empty_region_result" "empty_region_result" 和 'store_empty_region' "store_empty_region" "store_empty_region" "store_empty_region" "store_empty_region" "store_empty_region" 的值,可确定系统对输入图像和输出区域的行为方式。如有必要,则抛出异常。
可能的前趋
mean_image mean_image MeanImage MeanImage MeanImage mean_image ,
smooth_image smooth_image SmoothImage SmoothImage SmoothImage smooth_image ,
binomial_filter binomial_filter BinomialFilter BinomialFilter BinomialFilter binomial_filter ,
gauss_filter gauss_filter GaussFilter GaussFilter GaussFilter gauss_filter
可能的后继
connection connection Connection Connection Connection connection ,
select_shape select_shape SelectShape SelectShape SelectShape select_shape ,
reduce_domain reduce_domain ReduceDomain ReduceDomain ReduceDomain reduce_domain ,
select_gray select_gray SelectGray SelectGray SelectGray select_gray ,
rank_region rank_region RankRegion RankRegion RankRegion rank_region ,
dilation1 dilation1 Dilation1 Dilation1 Dilation1 dilation1 ,
opening opening Opening Opening Opening opening ,
erosion1 erosion1 Erosion1 Erosion1 Erosion1 erosion1
替代
check_difference check_difference CheckDifference CheckDifference CheckDifference check_difference ,
threshold threshold Threshold Threshold Threshold threshold
另见
highpass_image highpass_image HighpassImage HighpassImage HighpassImage highpass_image ,
sub_image sub_image SubImage SubImage SubImage sub_image
模块
基础