Git Product home page Git Product logo

face_detection's Introduction

Facial Landmark Detection with OpenCV

This project demonstrates how to detect facial landmarks in real-time using OpenCV. It uses a pre-trained Haarcascade classifier for face detection and a pre-trained LBF (Local Binary Features) model for facial landmark detection. The application captures frames from a webcam, detects faces and their landmarks, and displays them with connected lines and circles.

Features

  • Real-time face detection using Haarcascade classifier.
  • Real-time facial landmark detection using the LBF model.
  • Visualization of facial landmarks with both circles (dots) and lines connecting the points.
  • Saves the last captured frame with detected landmarks.

Requirements

  • Python 3.7+
  • OpenCV (cv2)
  • NumPy
  • Internet connection to download the necessary models

Setup Instructions

  1. Clone the Repository:

    git clone https://github.com/yourusername/facial-landmark-detection.git
    cd facial-landmark-detection
  2. Install the Required Packages:

    You can install the required Python packages using pip:

    pip install opencv-python opencv-contrib-python numpy
  3. Download the Pre-trained Models:

    The script automatically downloads the Haarcascade classifier for face detection and the LBF model for facial landmark detection if they are not already present in the data directory.

Usage

  1. Run the Script:

    python facial_landmark_detection.py
  2. Functionality:

    • The script opens a window showing the live feed from your webcam.
    • Detected faces and their landmarks are displayed with circles and lines.
    • Press q to quit the application and close the window.
  3. Saved Output:

    • The script saves the last captured frame with detected landmarks as face-detect.jpg in the current directory.

Code Overview

'''
Facial Landmark Detection in Python with OpenCV

Detection from webcam
'''

# Import Packages
import cv2
import os
import urllib.request as urlreq
import numpy as np

face_detection's People

Contributors

code-with-dhruv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.