Esempio n. 1
0
from cvzone.FaceMeshModule import FaceMeshDetector
import cv2

cap = cv2.VideoCapture(0)
detector = FaceMeshDetector(maxFaces=2)
while True:
    success, img = cap.read()
    img, faces = detector.findFaceMesh(img)
    if faces:
        print(faces[0])
    cv2.imshow("Image", img)
    cv2.waitKey(1)
Esempio n. 2
0
cap = cv2.VideoCapture(0)
detector = FaceMeshDetector(maxFaces=1)

textList = [
    "Wecome to", "Updaun Github.", "Here we will study", "Computer Vision,",
    "Robotics and AI.", "If you like this code", "Enjoy and Share",
    "Thank you."
]

sen = 25

while True:
    success, img = cap.read()
    imgText = np.zeros_like(img)
    img, faces = detector.findFaceMesh(img, draw=False)

    if faces:
        face = faces[0]
        pointLeft = face[145]
        pointRight = face[374]

        w, _ = detector.findDistance(pointLeft, pointRight)
        W = 6.3

        # Finding distance
        f = 840
        d = (W * f) / w
        print(d)

        cvzone.putTextRect(img,