Python Yüz Algılama X Değeri (Python Face Detection X Value)
Python Yüz Algılama X Değeri (Python Face Detection X Value)
from cvzone.PlotModule import LivePlot
from cvzone.FaceDetectionModule import FaceDetector
import cv2
import cvzone
cap = cv2.VideoCapture(1)
detector = FaceDetector(minDetectionCon=0.85, modelSelection=0)
xPlot = LivePlot(w=1200, yLimit=[0, 500], interval=0.01)
while True:
success, img = cap.read()
img, bboxs = detector.findFaces(img, draw=False)
val = 0
if bboxs:
# Loop through each bounding box
for bbox in bboxs:
# bbox contains 'id', 'bbox', 'score', 'center'
# ---- Get Data ---- #
center = bbox["center"]
x, y, w, h = bbox['bbox']
score = int(bbox['score'][0] * 100)
val = center[0]
# ---- Draw Data ---- #
cv2.circle(img, center, 5, (255, 0, 255), cv2.FILLED)
cvzone.putTextRect(img, f'{score}%', (x, y - 10))
cvzone.cornerRect(img, (x, y, w, h))
imgPlot = xPlot.update(val)
cv2.imshow("Image Plot", imgPlot)
cv2.imshow("Image", img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
Bu Yazıya Tepkin Nedir?