Giter Site home page Giter Site logo

movement-tracking's Introduction

Realtime Face Movement Tracking

90 Lines of code to convert your face movement into keyboard commands.

Description

This is a basic face movement tracking that can convert face movement into keyboard commands like UP - DOWN - LEFT - RIGHT. I used facial landmarks to detect face and get the nose out of it for better referencing. I have created two versions of it, v1 is using a fixed reference boundary which not work expected properly because we need to come at the same position after each movement. To save this I created V2 which uses position change with respect to the previous position. This is more dynamic and easy to control the moves. No need to set position again and again.

movement-v1.py

In version1, I used a fixed reference boundary. If nose reference is out of boundary then I calculate the direction of movement. After getting direction I am converting it into keyboard commands using the keyboard library.

movement-v2.py

In version2, I am using reference change with respect to the previous position in a particular time window and then calculating the direction vector to get direction and converting it to keyboard command.

Dependencies

This is the list of dependencies for running this application. Use pip to install them.

  • opencv
  • keyboard

How to use

  1. Download or clone this repository.

  2. Extract to some location.

  3. First, run movement-v1.py (for fix boundary) or run movement-v2.py(for dynamic movement)
    NOTE: If you are getting 215 assertion failed!! on line 81 check this (surya-veer#4 (comment))

  4. open any online atari game like Subway surfers or temple run.

  5. Start doing movements to play game. It will press up-down-left-right based on your movements.

Fun with face movements

Open any online game on the browser which needs UP-DOWN-LEFT-RIGHT movements following games, you can find many games if you search on google.

  1. Subway surfer https://www.kiloo.com/subway-surfers/
  2. Temple run https://m.plonga.com/adventure/Temple-Run-2-Online-Tablet

You can do a lot more things by the small code change.

** SUPPORT OPEN SOURCE **

movement-tracking's People

Contributors

surya-veer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.