QQ登录

只需一步,快速开始

halcon dual_threshold 函数介绍

[ 复制链接 ]
dual_threshold(Image : RegionCrossings : MinSize, MinGray, Threshold : )
dual_threshold将输入图像Image 细分为
灰度值>=Threshold (“positive”区域)
灰度值<=Threshold (“negative”区域)的区域。
只有“positive” 或 “negative”区域的面积比MinSize大才考虑。
而最大灰度值的绝对值小于MinGray的区域被抑制。


所执行的分割并非都完整,即,“正”和“负”区域在一起不一定覆盖整个图像:
灰度值在-Threshold ,Threshold ,或-MinGray和MinGray之间的区域不考虑。


dual_threshold通常在一个拉普拉斯算子执行后调用(laplace, laplace_of_gauss, derivate_gauss ,diff_of_gauss),
或执行了两个图像之差(sub_image)之后调用的。


拉普拉斯图像的零点交叉对应于图像中的边缘,是拉普拉斯图像中“positive”和“negative”区域的分离区域。
可以通过调用 Threshold =1的dual_threshold,然后调用 complement创建区域补集来确定它们。
参数MinGray决定了噪声的不变性,
而MinSize决定了边缘检测的分辨率。


使用字节图像,只应用运算符的正部分。
因此,dual_threshold的行为类似标准阈值操作符((threshold)再连续调用 connection 和select_gray。


例程:
read_image (Traffic1, 'traffic1')
read_image (Traffic2, 'traffic2')
convert_image_type (Traffic1, ImageConverted1, 'int2')
convert_image_type (Traffic2, ImageConverted2, 'int2')
* Subtract two images.
sub_image (ImageConverted1, ImageConverted2, ImageSub, 1, 0)
dual_threshold (ImageSub, RegionDiff, 500, 20, 10)
get_image_size (Traffic1, Width, Height)
dev_close_window ()
dev_open_window (0, 0, 2 * Width, 2 * Height, 'black', WindowHandle)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
dev_set_part (0, 0, Height - 1, Width - 1)
dev_set_draw ('margin')
dev_set_colored (6)
dev_display (Traffic1)
dev_display (RegionDiff)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* Select regions based on gray value features
select_gray (RegionDiff, Traffic1, SelectedRegions, 'deviation', 'and', 20, 255)
dilation_circle (SelectedRegions, RegionDilation, 1.5)
reduce_domain (Traffic1, RegionDilation, ImageReduced)
binary_threshold (ImageReduced, Region, 'max_separability', 'dark', UsedThreshold)
* Transform the shape of a region.
shape_trans (Region, RegionTrans, 'convex')
dev_set_draw ('margin')
dev_set_colored (6)
dev_display (Traffic1)
dev_display (RegionTrans)

  

halcon从自学到接项目视频教程,另外再赠送全网最全资源  

  

欢迎围观我录制的一套halcon自学视频教程(进入)


回复

使用道具 举报

快速回复 返回列表 客服中心 搜索