Real time face tracking application using the Pigo face detection library to convert face movements into keyboard actions like UP, DOWN, LEFT, RIGHT. This means you can play games without being physically attached to a keyboard device or you can navigate through your web browser like you would navigate with the arrow keys.
This is achieved due to the library high performance facial landmark points detection capabilities.
The Pigo library is capable of high accuracy facial landmark points detection, but out of the existing 15 facial landmark points the nose provides the best accuracy for face tracking, so this has been used to track the head movement. When a head movement is detected a keyboard press event is triggered through the OS system events as you would press the key physically.
Notice: at least Go 1.13 is required!
$ go get -u -v github.com/esimov/pigo-face-tracking
To run it is as simple as to type a single make
command from the project root directory:
- This will spawn a new web server listening on
localhost:5000
, will start the webcam and track your head movement continuously. - Now find some Atari like online games and start playing. https://m.plonga.com/ is one of the options.
- Move your head as you would play with the arrow keys.
This program has been tested on Linux and MacOS, but normally it should also run on Windows.
Because of the OS imposed security constrains there are some important steps you need to take:
In MacOS you must set the accessibility authorization for the terminal you are running from.
On Linux the library used for triggering the keyboard events uses uinput, which on the major distributions requires root permissions.
The easy solution is running the command with sudo
. Another, but not recommended approach is to change the executable's permissions by using chmod
. For this reason you can run the accompanied permission.sh
shell file.
- Endre Simo (@simo_endre)
Copyright © 2020 Endre Simo
This software is distributed under the MIT license. See the LICENSE file for the full license text.