A Python program (Windows only, Python 3.8+) for controlling your mouse using your face. Uses your webcam and tracks your face's orientation using a trained model from dlib. There are two modes of control, absolute mouse position, and joystick.
- Download and extract, or clone this repo to a location of your choice.
- Install Prerequisites (recommend using virtualenv):
pip install opencv-python
pip install dlib
pip install imutils
pip install pynput
pip install pywin32
- Download this trained model from dlib and place it into the resources folder.
- Run the program:
python <install_path>\face_aimer.py
- Calibrate the camera by following the prompts in the Face Aimer window that appears.
- The program will now begin controlling the mouse. While the Face Aimer window is in focus:
- Press the ESC key to quit the program
- Press the TAB key to switch between mouse and stick control modes
- Press the SPACEBAR to pause and unpause the program's control of your mouse
- Add text to indicate the currently selected control mode
- Improve facial tracking by utilizing more tracked points from the model
- Add re-calibrate option
- Implement offsets based on head translation so you don't need to keep your head locked in place
- Create better installation process
- Referenced Satya Mallick's tutorial: https://learnopencv.com/head-pose-estimation-using-opencv-and-dlib/
- Also referenced this project: https://github.com/lincolnhard/head-pose-estimation