©Fu Xianjun. All Rights Reserved.
#导包
import cv2
import numpy as np
def cv_show(name,img):
cv2.imshow(name,img)
cv2.waitKey(0)
cv2.destroyAllWindows()
/#效果
image=cv2.imread("test_01.png")
cv_show("name",image)
#轮廓
image=cv2.imread("test_01.png")
contours_img=image.copy()
gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
gs=cv2.GaussianBlur(gray,(5,5),0)
edge=cv2.Canny(gs,75,200)
cnts=cv2.findContours(edge,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)[0]
cv2.drawContours(contours_img,cnts,-1,(255,255,0),2)
cv_show("contours_img",contours_img)
//轮廓效果