halcon学习(一)dyn_threshold

dyn_thresh 动态阈值分割

当前背景之间差异明显时,可以设定全局阈值进行threshold,但很多情况下由于背景不均一,目标体经常表现为比背景局部亮一些或暗一些,无法确定全局阈值操作,需要通过其邻域找到一个合适的阈值进行分割。ThresholdImage是参考图像,通过与OrigImage对比找到领域确定阈值,一般采用平滑滤波算子(如mean_image)获取参考图像。offset设定邻域比较的区间范围,灰度值变化在offset范围内均是可以接受的。令 g_{o} = g_{OrigImage}, g_{t} = g_{ThresholdImage}分别代表原图和参考图中的像素点的灰度值.我们的做法是把参考图像的灰度值加上(减去)一个Offset,然后去和原图的像素点逐像素对应地进行比较。下面看Halcon中给出的这些公式:

The condition for LightDark = 'light' is:g_o>=g_t+offset ,light就提取相对参考图更亮的区域。

For LightDark='dark' ,the conditon is: g_o<=g_t-offset ,dark就提取相对参考图更暗的区域

For LightDark='equal',g_t-offset<=g_o<=g_t+offset,选取和参考图差不多的区域。


Withdyn_threshold, contours of an object can be extracted, where the objects' size (diameter) is determined by the mask size of the lowpass filter and the amplitude of the objects' edges:The larger

the mask size is chosen, the larger the found regions become. As a rule of thumb, the mask size shouldbe about twice the diameter of the objects to be extracted. It is important not to set the parameter Offset to zero because in this case too many small regions will be found (noise). Values between 5 and 40 are a useful choice. The largerOffset is chosen, the smaller the extracted regions become. All points of the input image fulfilling the above condition are stored jointly in one region. If necessary, the connected components can be obtained by callingconnection.




  • 11
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值