码迷,mamicode.com
首页 > 编程语言 > 详细

阈值分割算子之OSTU算法

时间:2019-08-28 01:05:18      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:autot   参考   max   cpp   absolute   hal   his   https   图片   

1、原理参考:https://www.cnblogs.com/guopengfei/p/4759569.html

2、公式推导:

      技术图片

3、同halcon的binary_threshold (Image, Region, ‘max_separability‘, ‘light‘, UsedThreshold3)算子。

    具体推导如下:

 gray_histo (Region, Image, AbsoluteHisto, RelativeHisto)
 nAveragray:=0
 for Index := 0 to 255 by 1
     nAveragray:=nAveragray+RelativeHisto[Index]*Index 
 endfor
 wk:=0.0
 uk:=0.0
 MaxDiff:=0.0
 Diff:=0.0
 AutoThre:=0

 for Index := 0 to 255 by 1
     wk:=wk+RelativeHisto[Index]
     uk:=uk+RelativeHisto[Index]*Index
     if(wk<=0.0 or wk>=1.0)
          Diff:=0
     else
          Diff:=(nAveragray*wk-uk)*(nAveragray*wk-uk )/(wk*(1-wk))
     endif
     if(Diff>MaxDiff)
           MaxDiff:=Diff
           AutoThre:=Index
     endif
 endfor

  

 

阈值分割算子之OSTU算法

标签:autot   参考   max   cpp   absolute   hal   his   https   图片   

原文地址:https://www.cnblogs.com/baiyy-daheng/p/11421537.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!