第九节 图像处理之图像的二值化
图像的二值化(需要是灰度图像) import cv2 as cv import numpy as np def threshold_demo(image): gray = cv.cvtColor(image,cv.COLOR_BGR2GRAY) #cv.THRESH_TRIANGLE与cv.THRESH_OTSU是自动寻找阈值,这个时候threshold值必须是0 #如果threshold不为0,即是自己指定的(如127),那么type就直接THRESH_BINARY就够了 ret,binary = cv.threshold(gray,0,255,
下载地址
用户评论