手动实现二值化

img_gray = cv2.imread(r"./example.png", 0)
# the threshold you want is thr
thr = 127
bw = ((img_gray / (thr * 2)) > 0.5).astype(np.uint8) * 255    # INV: ">" -> "<"
posted @ 2017-11-19 15:23  默盒  阅读(333)  评论(0编辑  收藏  举报