HandyBird is the classic game Flappy Bird written in C++ using OpenCV4 and SFML libraries with real-time hand gesture detection to fly the bird instead of using keyboards.
- C++ compiler (gcc, g++, ...)
- OpenCV
- Cmake
- SFML
For C++ compiler, Cmake, SFML and their dependencies, use following command:
sudo apt-get install cmake g++ libsfml-dev
mkdir build && cd build && cmake .. && cd ..
cmake -S . -B build
cmake --build build
Then you can run the program:
build/HandyBird
-
Initialy, we need to remove background behind the user so that the program can find it easier to detect user's hand. After running the program, 2 windows camera and foreground show up. The camera is the main window for you to track yourself while playing. The foreground window is used to guarantee the background is removed properly. To start removing the background, without showing hand on the camera, press
b
, the foreground window will show images of removal of the background and user's face. If it's not done properly, pressb
and repeat the step. -
Then, we will find user's color skin. In order to do that, user need to place their hand in the sample area and press
s
key. The foreground window will disappear and the contour of user's hand will be shown on the camera window.
- To start playing game, we move the cursor to the Handy Bird window and press
space
. To fly up the bird, open your hand widely which is equal to pressspace
in Flappy Bird game. To stop flying, close your hand like a fist (equal to releasespace
). When the game is over, pressc
to continue and repeat pressingspace
key and continuing to play.