Calculate the histogram of the M×M operational region
and select an initial estimate for Ts. Iteratively compute a
new threshold value using Eq.
(1) until the threshold value converges. Save the value in the corresponding position of the center of the operational region to the coarse threshold value grid.