def toBin(img, thr=200): #return (img < thr).astype(np.uint8) return (img < thr).max(axis=2).astype(np.uint8)