Motion-Mouse is an innovative desktop application that allows you to control your computer's mouse pointer and clicks using your webcam! It leverages advanced AI models for facial tracking and hand gesture recognition, eliminating the need for a physical mouse.
Built with Electron, Vite, MediaPipe, and Python.
- Face Tracking (Mouse Movement): The application tracks your nose using your webcam and translates its position into on-screen mouse movements. It features dynamic smoothing and calibrated baselines so the cursor is responsive but stable.
- Gesture Recognition (Clicks & Actions):
- Left Click: Pinch your thumb and index finger.
- Right Click: Pinch your thumb and middle finger.
- Scroll Mode: Fold your ring finger down. Once active, moving your head up and down will scroll the screen.
- Mute Tracking: Form a closed fist to temporarily pause tracking and release clicks. Open your palm to resume.
- Quit Application: Pinch your thumb and ring finger together.
- Body Measurements: The app roughly estimates and displays real-time shoulder width, torso length, and hip width based on skeletal points.
To run this application, you need the following installed on your system:
-
Clone the repository:
git clone https://github.com/rasindugimhan/Motion-Mouse.git cd Motion-Mouse -
Install Python dependencies:
pip install pyautogui
-
Install Node.js dependencies:
npm install
To start the application in development mode with hot-reloading:
npm run devTo build the application for production:
npm run build- Frontend (
main.js): Uses Google's@mediapipe/tasks-visionlibrary via a webcam feed to analyze pose, face, and hand gestures in real time directly in the browser/Electron renderer process. - Backend (
electron/main.js): Acts as the bridge. It captures IPC messages (likemove-mouse,mouse-click) from the frontend. - OS Controller (
electron/mouse_control.py): The Electron main process spawns a Python script in the background. It sends JSON commands to this script viastdin. The Python script usespyautoguito execute actual system-level mouse movements and clicks.
- Webcam not opening: Make sure no other application (like Zoom or Teams) is actively using the webcam. Electron requires the proper media permissions to access the camera, which this application handles automatically.
- Mouse getting stuck: Ensure you are well-lit and your face/hands are clearly visible to the camera. Use the "Closed Fist" gesture to mute the tracking and reset your position.
This project is open-source and available for everyone to use and experiment with.