[
  {
    "path": "README.md",
    "content": "## facial landmarks recognition \n\n![My Face](https://i.imgur.com/7IIOka9.png)\n\n### Dependencies \n`pip install -r .\\requirements.txt`\n\n### Run\n`python main.py`"
  },
  {
    "path": "main.py",
    "content": "# import the necessary packages\nfrom imutils import face_utils\nimport dlib\nimport cv2\n \n# initialize dlib's face detector (HOG-based) and then create\n# the facial landmark predictor\np = \"shape_predictor_68_face_landmarks.dat\"\ndetector = dlib.get_frontal_face_detector()\npredictor = dlib.shape_predictor(p)\n\ncap = cv2.VideoCapture(0)\n \nwhile True:\n    # load the input image and convert it to grayscale\n    _, image = cap.read()\n    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n        \n    # detect faces in the grayscale image\n    rects = detector(gray, 0)\n    \n    # loop over the face detections\n    for (i, rect) in enumerate(rects):\n        # determine the facial landmarks for the face region, then\n        # convert the facial landmark (x, y)-coordinates to a NumPy\n        # array\n        shape = predictor(gray, rect)\n        shape = face_utils.shape_to_np(shape)\n    \n        # loop over the (x, y)-coordinates for the facial landmarks\n        # and draw them on the image\n        for (x, y) in shape:\n            cv2.circle(image, (x, y), 2, (0, 255, 0), -1)\n    \n    # show the output image with the face detections + facial landmarks\n    cv2.imshow(\"Output\", image)\n    k = cv2.waitKey(5) & 0xFF\n    if k == 27:\n        break\n\ncv2.destroyAllWindows()\ncap.release()\n"
  },
  {
    "path": "requirements.txt",
    "content": "opencv-python==4.7.0.72\nimutils==0.5.4\ndlib==19.24.0"
  }
]