I\'m trying to implement the following Minimum Error Thresholding (By J. Kittler and J. Illingworth) method in MATLAB.