赞
踩
目录
- import cv2
- surimg = cv2.imread(filename)
- height, width = img.shape[:2]
- gray = cv2.cvtColor(surimg, cv2.COLOR_BGR2GRAY)
-
- # 二值化
- # ret, binary = cv2.threshold(gray, 125, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
- ret, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU) # 这个效果最好
- cv2.imshow('a_window', binary)
- cv2.WaitKey(0)
image
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。