Skip to main content
. 2016 Sep 20;265(2):185–195. doi: 10.1111/jmi.12474

Table 1.

Pseudo‐code for the global threshold algorithm using the gradient of region boundaries.

Find minimum L Min and maximum L Max grey levels of image I
Compute image gradient (Sobel filter or Beucher gradient G = (IA) – (I A))
For all values L from L Min to L Max {
Set a test threshold at L
Create a thresholded phase B(L) by labelling pixels valued 0 to L as foreground
Compute the phase boundary E(L) = B(L) – (B(L) A)
Store the total G Total(L) (or average G Average(L)) gradient (in G) of pixels in E(L)
}
Set T Optimal to the L with maximum G Total (L) (or average G Average (L))