49

GitHub - vietnguyen1991/AirGesture: Play games without touching keyboard

 4 years ago
source link: https://github.com/vietnguyen1991/AirGesture
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

[PYTHON] AirGesture - Play games without touching keyboard

Introduction

Here is my python source code for AirGesture - Play games without touching keyboard. This project is an application of hand detection model in Tensorflow. With my code, you could play many games on PC without using any keyboard. At the moment you could play the following games

  • Super Mario Bros by running the script mario.py
  • Battle City by running the script battle_city.py
  • Dinosaur Game by running the script dinosaur.py

Please make sure that only one hand shown in front of camera. Otherwise scripts may not work as well as you expect

Super Mario Bros

The screen is splitted into 3 equal parts horizontally. Here is the mapping between your gesture and Mario's movement:

  • Open hand within the left part -> Left jump
  • Closed hand within the left part -> Left run
  • Open hand within the middle part -> Jump
  • Closed hand within the middle part -> Do nothing
  • Open hand within the right part -> Right jump
  • Closed hand within the right part -> Right run

Super_mario_bros_demo.gif
Super Mario Bros

Battle City

The screen is splitted into 5 parts, including 4 triangles and a circle. Here is the mapping between your gesture and tank's movement:

  • Open hand -> Fire
  • Closed hand within the circle -> Do nothing
  • Closed hand within the left triangle -> Go left
  • Closed hand within the right triangle -> Go right
  • Closed hand within the up triangle -> Go up
  • Closed hand within the left triangle -> Go down

Battle_city_demo.gif
Battle City

Dinosaur Game

The screen is splitted into 2 equal parts vertically. Here is the mapping between your gesture and dinosaur's action:

  • Closed hand -> Run
  • Open hand within the upper part -> Jump
  • Open hand within the lower part -> Duck

Dinosaur_demo.gif
Dinosaur

Requirements

  • python 3.x
  • cv2
  • tensorflow
  • numpy
  • gym
  • gym_super_mario_bros
  • gym_chrome_dino
  • pygame
  • opencv

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK