赞
踩
import cv2 as cv
import numpy as np
img = cv.imread('./dog.jpeg')
img1 = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
ret, dst = cv.threshold(img1,180,255, cv.THRESH_BINARY)
cv.imshow('img', img)
cv.imshow('img1', img1)
cv.imshow('dst', dst)
cv.waitKey(0)
import cv2 as cv
import numpy as np
img = cv.imread('./dog.jpeg')
img1 = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
# ret, dst = cv.threshold(img1,180,255, cv.THRESH_BINARY)
dst = cv.adaptiveThreshold(img1, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C,cv.THRESH_BINARY, 3, 0)
cv.imshow('img', img)
cv.imshow('img1', img1)
cv.imshow('dst', dst)
cv.waitKey(0)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。