This project is a simple Python application that captures video from a webcam, detects hand landmarks, and displays icons above raised fingers. The project uses OpenCV for video processing and MediaPipe for hand landmark detection.
- Captures video from the webcam.
- Detects hand landmarks using MediaPipe.
- Displays icons above raised index, middle, and ring fingers.
- Custom window icon for the application.
- Python 3.x
- OpenCV
- MediaPipe
- pywin32
-
Clone the repository:
git clone https://github.com/msaifulhuda/finger-detection.git cd finger-detection -
Install the required packages:
pip install opencv-python mediapipe pywin32
-
Place your icon images (
i.png,love.png,u.png) in the./icon/directory.
Run the main script to start the application:
python main.pyThe main functionality of the project is implemented in the main.py script. Here is a brief overview of the process:
- Open video capture from the webcam.
- Read frames from the video capture.
- Flip the frame horizontally.
- Convert the frame from BGR to RGB.
- Process the frame to detect hand landmarks.
- If hand landmarks are detected:
- Draw hand landmarks on the frame.
- Calculate the positions of the fingertips and joints for the index, middle, and ring fingers.
- Determine if the index, middle, or ring finger is raised.
- Display an icon above the raised finger.
- Display the frame with icons in the 'Finger Icons' window.
- Set the window icon.
- Close the video capture and window when the 'Esc' key is pressed or the window is closed.
Feel free to contribute to this project by submitting issues or pull requests.