- We start capturing video and drawing the Virtual Mousepad Region on every frame.
- If the hand is detected in the frame, we take landmark points of index finger tip, thumb tip, and middle fingertip.
- We check if index fingertip is inside virtualMousePadRegion or not. If YES then we go for mouse tracking with gesture functionality. If NO then we read the next frame.
- We implement logic to track the movement of index finger tip and we use that information to move mouse pointer.
- We also implement logics for right click, left single click and left double click mouse functionalities.
Check out the images at the end of this file to understand the logic for coordinate transformations and other calculations used in code.
Demo Video: