made RECT_ERROR relative
possible thresholding methods
initial threshold algorithm (average black max and white max)
made threshold algorithm work