from cvzone.FaceMeshModule import FaceMeshDetector
import cv2

ESC = 27

cap = cv2.VideoCapture(0)
ratio = cap.get(cv2.CAP_PROP_FRAME_WIDTH) / cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
WIDTH = 400
HEIGHT = int(WIDTH / ratio)

detector = FaceMeshDetector(maxFaces = 2)

while cap.isOpened():
    success, img = cap.read()
    img = cv2.resize(img, (WIDTH, HEIGHT)) 
    img, faces = detector.findFaceMesh(img)
    if faces:
        print(faces[0])
    cv2.imshow('Image', img)

    if cv2.waitKey(1) == ESC:
        break
    
cap.release()
cv2.destroyAllWindows()