本篇测评由电子发烧友的优秀测评者“筑梦者与梦同行”提供。
前言MYD-JX8MMA7SDK发布说明
#!/usr/bin/env python3
"""
Created on Thu Sep 30 07:53:41 2021
"""
from future import print_function
import numpy as np
import cv2
img = cv2.imread('b.jpg')
cv2.imshow("orginal",img)
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imshow("gray",gray)
gaussian = cv2.GaussianBlur(gray, (5, 5), 0)
cv2.imshow("gaussian",gaussian)
edged=cv2.Canny(gaussian,50,200)
cv2.imshow("edged",edged)
cts, hierarchy = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(img, cts, -1, (0,0,255), 3)
cv2.imshow("img",img)
cv2.waitKey()
cv2.destroyAllWindows()
▲保存图片扫码购买
米尔电子
长按二维码 关注我们