added OTSU thresholding and small fixes to distortion correction