Custom Thresholding In Image Processing