This repository contains two Python-based experiments utilizing OpenCV and MediaPipe for real-time video processing and interaction. The projects are aimed at demonstrating the capabilities of computer vision and pose detection in creating engaging, interactive applications.
This experiment creates an interactive game where players use their body movements to catch a virtual ball on the screen. It uses OpenCV for image processing and MediaPipe for pose detection.
- Ensure you have Python installed on your system.
- Install the required libraries: OpenCV and MediaPipe.
- Run the script
ball_catching_game.py
.
- Pose Detection: Utilizes MediaPipe's pose detection to track the player's movements.
- Interactive Gameplay: Players use their body part (e.g., hand) to catch a virtual ball.
- Customizable Settings: Options to select the body part for interaction and toggle mirror mode.
- Real-time Feedback: Displays current score and updates the game in real-time.
- Video Capture & Processing: Captures video frames and processes them for pose detection.
- Dynamic Object Interaction: Generates a virtual ball with random positions and colors.
- Collision Detection: Checks if the selected body part touches the virtual ball.
- User Interface: Displays a simple menu for game controls and shows the player's score.
This application detects and tracks whether a person is sitting or standing and recognizes facial expressions (specifically, smiling). It leverages both pose and facial landmark detection using MediaPipe.
- Ensure Python is installed on your system.
- Install OpenCV and MediaPipe libraries.
- Execute the script
sit_stand_smile_detection.py
.
- Pose Analysis: Detects and analyzes the body posture (sitting or standing).
- Facial Expression Recognition: Identifies if the person is smiling using facial landmarks.
- State Change Counter: Counts and displays the number of times the person changes from sitting to standing and vice versa.
- Real-time Display: Shows the current state, smile status, and shoulder movement.
- Video Capture & Pose Detection: Processes video frames for body pose analysis.
- Facial Landmark Detection: Identifies and processes facial landmarks to detect smiling.
- Posture Analysis: Differentiates between sitting and standing by comparing the relative positions of hips and knees.
- Interactive Feedback: Provides instant feedback on the screen about the person's posture and facial expression.
To run these experiments, you need to install certain Python libraries. You can install these using pip:
pip install opencv-python
pip install mediapipe
After installing the required libraries, you can run each script from the command line:
python ball_catching_game.py
or
python sit_stand_smile_detection.py
Ensure your webcam is functional, as the experiments rely on real-time video input.
Contributions to this project are welcome. Please fork the repository and submit a pull request for any enhancements.
This project is open-sourced under the MIT License. See the LICENSE file for more details.