Skip to content

KushPatel-18/FaceLandmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FaceLandmark

Live Video Facial Landmarks Detection Project using MediaPipe - Precursor for Future Projects

This Python project uses MediaPipe to perform real-time face landmark detection and visualize facial blendshapes from webcam video input. It leverages the face_landmarker_v2_with_blendshapes.task model to track facial landmarks and compute blendshape scores for animation or expression analysis.


Features

  • Real-time face landmark detection with MediaPipe's FaceLandmarker
  • Visualizes face mesh, contours, and irises
  • Plots facial blendshape scores as a horizontal bar chart
  • Easy to run on webcam video input (can be modified for video files)

Requirements

  • Python 3.8+
  • OpenCV
  • NumPy
  • Matplotlib
  • MediaPipe with Tasks API

Install the required Python packages:

pip install opencv-python mediapipe matplotlib numpy

Setup

1. Download the Face Landmarker Model

This project requires the face_landmarker_v2_with_blendshapes.task model file, which is not included in this repository.

You can download it from the official MediaPipe documentation:

👉 Download face_landmarker_v2_with_blendshapes.task

2. Place the Model in Your Project

Make sure the model file is saved in your project directory and named:

face_landmarker_v2_with_blendshapes.task

How to Run

Once dependencies are installed and the model file is in place, run the program with:

python face_landmark_live.py

Note: Replace face_landmark_live.py with your actual script filename if different.

Press q in the OpenCV window to quit the application.


What It Does

  • Captures frames from your webcam
  • Converts frames to RGB and runs face landmark detection
  • Annotates the frame with:
    • Mesh tessellation
    • Facial contours
    • Iris landmarks
  • Optionally, plots a blendshape bar chart (currently disabled in live mode for performance)

What It Should Look Like

Screenshot 1 Screenshot 2 Screenshot 3
Screenshot 1 Screenshot 2 Screenshot 3

Customization Tips

  • To use a video file instead of webcam input, change this line:
cap = cv2.VideoCapture(0)

to:

cap = cv2.VideoCapture('path_to_your_video.mp4')
  • To enable blendshape bar plots per frame (may slow down performance), you can insert this inside the video loop:
plot_face_blendshapes_bar_graph(detection_result.face_blendshapes[0])

License

This project uses MediaPipe, which is licensed under the Apache 2.0 License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages