adding threshold for binarizing