Skip to main content

Face Detection Example

Code example here

Code

FaceDetectionExample.py
from nkdcv.FaceDetectionModule import FaceDetector
import cv2

cap = cv2.VideoCapture(0)
detector = FaceDetector()

while True:
success, img = cap.read()
img, bboxs = detector.findFaces(img)

if bboxs:
# bboxInfo - "id","bbox","score","center"
center = bboxs[0]["center"]
cv2.circle(img, center, 5, (255, 0, 255), cv2.FILLED)

cv2.imshow("Image", img)
cv2.waitKey(1)

Result

Face Detection Example