国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【開源】ESP32-cam+python 實(shí)現(xiàn)人臉識別(opencv)

2023-01-14 15:06 作者:謝必安_玄  | 我要投稿

import CV2

import numpy as np

import mediapipe as mp

import time


pTime = 0


cap = CV2.VideoCapture("http://192.168.31.89:81/stream")


mpFaceDetection = mp.solutions.face_detection


mpDraw = mp.solutions.drawing_utils


faceDetection = mpFaceDetection.FaceDetection(0.75)

def fancyDraw(img,bbox,l=30,t=5,rt=1):


? ? x,y,w,h=bbox

? ? x1,y1=x+w,y+h


? ? CV2.rectangle(img,bbox,(255,0,255),rt)

? ? #Top Left x,y


? ? CV2.line(img,(x,y),(x+1,y),(255,0,255),t)

? ? CV2.line(img,(x,y),(x,y+1),(255,0,255),t)

? ? # Top Right x1,y


? ? CV2.line(img,(x1,y),(x1-1,y),(255,0,255),t)

? ? CV2.line(img,(x1,y),(x1,y+1),(255,0,255),t)

? ? # Bottom Left x,y1


? ? CV2.line(img,(x,y1),(x+1,y1),(255,0,255),t)

? ? CV2.line(img,(x,y1),(x,y1-1),(255,0,255),t)

? ? # Bottom Right x1,y1


? ? CV2.line(img,(x1,y1),(x1-1,y1),(255,0,255),t)

? ? CV2.line(img,(x1,y1),(x1,y1-1),(255,0,255),t)

? ? return img


while True:

? ? success,img=cap.read()

? ? imgRGB =CV2.cvtColor(img,CV2.COLOR_BGR2RGB)

? ? results = faceDetection.process(imgRGB)

? ? if results.detections:

? ? ? ? for id , detection in enumerate(results.detettions):

? ? ? ? ? ? # mpDraw.draw_detection(img,detection)

? ? ? ? ? ? # print(id,detection)

? ? ? ? ? ? bboxC = detection.location_data.relative_bounding_box

? ? ? ? ? ? ih,iw,ic = img.shape


? ? ? ? ? ? bbox=int(bboxC.xmin*iw),int(bboxC.ymin* ih),int(bboxC.width * iw),int(bboxC.height* ih)

? ? ? ? ? ? # print(bbox)

? ? ? ? ? ? # CV2.rectangle(img,bbox,(255,0,255),2)

? ? ? ? ? ? img=fancyDraw(img,bbox,l=10)

? ? ? ? ? ? CV2.putText(img, f'{int(detection.score[0]* 100)}%', (bbox[0], bbox[1] - 20), CV2.FONT_HERSHEY_PLAIN, 3, (255, 0,255),2)

? ? cTime = time.time()

? ? fps=1/(cTime-pTime)

? ? pTime = cTime

? ? CV2.putText(img,f'FPS: {int(fps)}',(20,70),CV2.FONT_HERSHEY_PLAIN,3,(0,255,0),2)

? ? #旋轉(zhuǎn)90度,旋轉(zhuǎn)幾次

? ? img=np.rot90(img,k=3)

? ? CV2.imshow("img",img)

? ? CV2.waitkey(1)



【開源】ESP32-cam+python 實(shí)現(xiàn)人臉識別(opencv)的評論 (共 條)

分享到微博請遵守國家法律
长海县| 驻马店市| 庆元县| 三河市| 天全县| 巨野县| 九龙坡区| 青海省| 乌兰察布市| 泰兴市| 华坪县| 大足县| 晋州市| 大丰市| 财经| 新民市| 芜湖市| 甘洛县| 永修县| 车致| 天津市| 海林市| 昌平区| 怀来县| 西城区| 探索| 阿巴嘎旗| 乌兰察布市| 汝南县| 惠安县| 和田县| 壤塘县| 东港市| 琼中| 永仁县| 开鲁县| 和田市| 砚山县| 安泽县| 洛扎县| 石景山区|