0

I am working on a project involving a face tracker able to follow my face, printing the X-axis coordinate wherever I am on the screen. I have figured out how to get the bounding box to follow my face but have been struggling, with being able to print the X-axis coordinate. So far I haven't gotten anything to work, I thought this might be a good place to ask. If anyone knows how I would approach this problem that would be much appreciated thank you.

import cv2
from cvzone.FaceDetectionModule import FaceDetector
cap=cv2.VideoCapture(0)

detector=FaceDetector()

while True:
    ret,img=cap.read()
    img, bboxs=detector.findFaces(img)
    cv2.imshow('webcam',img)
    k=cv2.waitKey(1)
    if k==27:
        break;

1 Answers1

0

In the given code, you are not extracting any values from bboxs paramerter. I visited their GitHub repository and detector.findFaces(img) function returns only "id","bbox","score","center".

If you scroll a little bit on their repository, then you will find this method of drawing rectangle

# Draw  Corner Rectangle
cvzone.cornerRect(img, bbox)
Usama Aleem
  • 113
  • 7