Python-OpenCV之findContours()与drawContours()
import cv2
img = cv2.imread('cc.png')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret, binary = cv2.threshold(gray,127,255,cv2.THRESH_BINARY)
contours, hierarchy = cv2.findContours(binary,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(img,cont
原创
2021-04-14 18:28:20 ·
150 阅读 ·
0 评论