Coder Social home page Coder Social logo

blinking-game's Introduction

The Blinking Game

Description

This Python script uses OpenCV, dlib, and imutils libraries for face and blink detection, as well as Pygame for the timer. It captures video streams from the webcam and detects faces. It also tracks the blinking of each person in the video. A timer is shown at the bottom of the screen. The person who blinks first is labeled 'LOSER', and others are labeled as 'WINNER'. The frames where someone is labeled as 'LOSER' for the first time and where others are labeled 'WINNER' are saved as 'loser.png' and 'winner.png', respectively.

Requirements

  • Python 3.6+
  • OpenCV
  • dlib
  • imutils
  • Pygame

Instructions

  1. Install the required Python packages if not already installed:
pip install opencv-python
pip install dlib
pip install imutils
pip install pygame
  1. Download the dlib's face landmarks model here, and ensure the path to it is correct in the script.

  2. Run the Python script:

python face_blink_detection.py
  1. To terminate the program, press 'q' while the webcam window is in focus.

Notes

  • Adjust the blink threshold (EYE_AR_THRESH) and the consecutive frames threshold (EYE_AR_CONSEC_FRAMES) according to your requirements and environment to increase/decrease the sensitivity of blink detection.
  • The script does not handle cases where more than one person blinks at the same time.
  • The 'winner.png' file is continuously overwritten with the current frame where others are detected until the program is terminated.

Credits

This code leverages OpenCV for webcam stream capture and image processing, dlib for face detection, and Pygame for timer functionality.

blinking-game's People

Contributors

artificialnouveau 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.