An efficient iterative algorithm for image thresholding