Skip to content

A gesture-controlled arcade game written in Python using OpenCV and PyGame. I made this to experiment with computer vision and to learn OpenCV in a fun way.

License

Notifications You must be signed in to change notification settings

omarkhan03/cv-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gesture-Controlled Arcade Game

Python opencv Pygame numpy

Table of contents

Description

A gesture-controlled arcade game written in Python using OpenCV and PyGame. I made this to experiment with computer vision and to learn OpenCV in a fun way. The main idea is that the player is able to make hand-gestures to control a spaceship and defeat enemies. The three hand-gesture inputs are:

  • Moving the spaceship around (simply move your hand around horizontally)
  • Shooting a bullet (point with index finger)
  • Flipping over the ship to target enemies on the other side (raise your thumb and pinkie finger)

On the left side of the window is the UI, which displays a video feed taken from your computer's camera. There are indicators for which hand gesture the player is currently making (overlayed on top of and above the video feed). It also contains information such as points and health. On the right side of the window is the actual game, which is essentially space invaders except the ship can flip around and shoot in two directions. There is only one level.


Gesture-Controlled.Arcade.Game.OpenCV.x.PyGame.mp4

Turn on sound!

Link to YouTube video.


How to install and run

The instructions below assume a Unix-like environment.

  1. If you don't have Python3 already installed on your system, install it from https://www.python.org/downloads/. Ensure you have the latest version of pip installed by following the instructions on https://pip.pypa.io/en/latest/installation/#ensurepip.

  2. Clone the repository

      git clone https://github.com/omarkhan03/cv-game.git
  3. CD into the Code directory

      cd Code
  4. Install all requirements

     pip install -r requirements.txt
  5. Run main.py

     python3 main.py

    Note - you may need to click on a prompt to allow the terminal to access your computer's camera.


Credits

  • Thanks to Murtaza's workshop's videos for helping to learn OpenCV as well as the CvZone library, from which I used the hand tracking module.

  • I built off of this PyGame tutorial by Clear Code on YouTube. Thanks a lot!

About

A gesture-controlled arcade game written in Python using OpenCV and PyGame. I made this to experiment with computer vision and to learn OpenCV in a fun way.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages