This project implements a virtual piano using OpenCV and Mediapipe, allowing users to play music by interacting with their hands in front of a camera. The application detects hand keypoints using Mediapipe's Hand module and maps them to corresponding piano keys on the screen.
final_demo.mp4
- Clone the repository
git clone https://github.com/NAGAMALLYSRUJAN2329/vir_piano.git
cd vir_piano
- Create new conda environment
conda create -n VirPiano python=3.10
- Activate the environment
conda activate VirPiano
- Install dependencies
pip install -r requirements.txt
python main.py
- If you want to change settings of the paino, use the below cli command.
python main.py --model_path "model/hand_landmarker.task" --num_octaves 2 --list_of_octaves "[3,4]" --height_and_width_black "[[5,8],[5,8]]" --shape "(800,600,3)" --tap_threshold 20 --piano_config_threshold 30 --piano_config 1
- Quit: Press 'Q' key.
streamlit run streamlit_main.py
- If there is no hand tracking, try adjusting the camera settings and lighting conditions and try to move the hand slowly in front of the camera.
- Ensure that your Python environment meets the specified requirements.
NAGAMALLYSRUJAN2329
Prachi-0205
Prkhar05
xenom2004
Contributions are welcome!