五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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)的評論 (共 條)

分享到微博請遵守國家法律
清水河县| 于都县| 洛隆县| 河北省| 旬邑县| 富锦市| 沅陵县| 同仁县| 惠水县| 东莞市| 苏州市| 都江堰市| 公安县| 岑溪市| 师宗县| 民乐县| 永靖县| 温泉县| 库尔勒市| 黄大仙区| 松溪县| 成都市| 五指山市| 正阳县| 仁化县| 潜江市| 余江县| 郴州市| 庆云县| 汤原县| 南江县| 济宁市| 株洲市| 安吉县| 郯城县| 黄平县| 武邑县| 安龙县| 镇江市| 怀宁县| 舟山市|