卓尔高考网

阈值分割算子之OSTU算法

篇首语:本文由小编为大家整理,主要介绍了阈值分割算子之OSTU算法相关的知识,希望对你有一定的参考价值。

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算法的主要内容,如果未能解决你的问题,请参考以下文章

您可能还会对下面的文章感兴趣: