After the preprocessing step, we used an iterative multiple thresholding algorithm to separate the image pixels into the foreground and background, where the threshold estimation depends on maximization of the between-class variances of the pixel values . This estimates the thresholds iteratively and returns two optimal thresholds. The iteration continues until the errors become small or the thresholds no longer change. We initialized the thresholds t1 and t2 as I/3 and 2I/3, respectively, where I indicates the intensity range of the image. The error functions are represented as ε1(t1,t2)=[m(0,t1)+m(t1,t2)]/2−t1(1) and ε2(t1,t2)=[m(t1,t2)+m(t2,∞)]/2−t2(2) where m(tm,tn)=1tm+tn+1∑h=tmtnw(h).h(3) where w(h) indicates the image histogram. The thresholds t1 and t2 were updated to force the errors ε1 and ε2 toward zero. The updated thresholds are represented as t1′=t1+ε1(4) t2′=t2+ε2(5)