QeyPoint-Face / use.py
Qarvexium's picture
Upload 3 files
d7f832b verified
Raw History Blame Contribute Delete
830 Bytes
import cv2
from QeyP import QeyPointDetector
detector = QeyPointDetector()
print("Starting stream demo. Press Q to quit.")
for result in detector.stream_from_cam(camera_id=0, wait_seconds=0.01):
if result is None:
continue
frame = result["frame"]
landmarks = result["landmarks"]
confidence = result["confidence"]
face_box = result["face_box"]
fx, fy, fw, fh = face_box
cv2.rectangle(frame, (fx, fy), (fx + fw, fy + fh), (255, 180, 0), 2, lineType=cv2.LINE_AA)
for (px, py), conf in zip(landmarks, confidence):
if conf > 0.0:
cv2.circle(frame, (int(px), int(py)), 3, (0, 255, 0), -1, lineType=cv2.LINE_AA)
cv2.imshow("QeyPoints Demo", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
print("Demo ended.")