Giter Club home page Giter Club logo

frontpose-detector's Introduction

FrontPoseDetector πŸ“ΈπŸ€–

FrontPoseDetector is a Python-based tool that leverages OpenCV and MediaPipe to detect whether a person is in a front-facing pose in both images and live video feeds. This tool can be useful for various applications, such as fitness tracking, gesture recognition, and many more.

Requirements

  • Python 3.x
  • OpenCV
  • MediaPipe

You can install the required packages using pip:

pip install opencv-python mediapipe

Files

frontposedetector.py

This script processes an image to detect whether the subject is in a front pose.

Key Functions

  • calculate_angle(v1, v2): Calculates the angle between two vectors.
  • is_front_pose(landmarks): Determines if the detected pose is a front pose based on specific landmark visibility and angles.

Usage

  1. Load an image using OpenCV.
  2. Resize and convert the image to RGB.
  3. Use MediaPipe to process the image and extract pose landmarks.
  4. Check if the pose is a front pose using the is_front_pose function.
  5. Draw landmarks on the image and display the result.

To run the script:

python frontPose.py

FrontVidpose.py

This script captures video from the webcam and detects if the subject is in a front pose in real-time. It also captures a photo if hands are detected in front of the chest and verifies the front pose in the captured image.

Key Functions

  • calculate_angle(v1, v2): Calculates the angle between two vectors.
  • is_front_pose(landmarks): Determines if the detected pose is a front pose based on specific landmark visibility and angles.
  • is_hand_in_front_of_chest(landmarks): Checks if any hand is in front of the chest.
  • capture_photo(): Captures a photo from the webcam.
  • countdown_and_capture(): Counts down and captures a photo.
  • handle_hands_in_front(): Handles the event when hands are detected in front.

Usage

  1. Initialize the webcam capture.
  2. Process each frame to detect pose landmarks.
  3. Check if hands are in front of the chest and handle the event accordingly.
  4. Display the pose landmarks on the video feed.

To run the script:

python frontVidpose.py

Demo

frontposedetector.py

Front Pose Not in Front Pose
Front Pose Not in Front Pose

FrontVidpose.py

The FrontVidpose.py script opens the webcam and processes the video feed in real-time. When the user shows hand gestures in front of the chest, the tool starts a countdown (5 seconds). After the countdown, it captures a photo and checks if the user is in a front pose. The captured photo is then saved.

Acknowledgments

frontpose-detector's People

Contributors

sahilshukla3003 avatar dhanashri2503 avatar

Stargazers

 avatar

Watchers

Kostas Georgiou avatar  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.