OpenCV Live Hand-Tracker

Live OpenCV-Webcam live hand detection and motion tracking application.

Related Tags...

PythonMovement TrackerComputer VisionOpenCV
2

Screenshot Gallery...

External Recognition

External Code for preparing the program take from https://techvidvan.com/tutorials/hand-gesture-recognition-tensorflow-opencv/
Provided pretrained hand-recognition TensorFlow network, implemented through Google Mediapipe
From this tutorial, the pretrained network was taken.

No author information nor git information provided

Hand Detection

Hand detection is executed using Google Mediapipe, with the pretrained hand-skeleton detection network.
From this skeleton, a box is drawn around the user’s hand and displayed on the screen.

Motion Tracking

As the hands more, the palm of the hand is measured and recorded. As the last 50 points are displayed on the screen, a post process filters connected points only. If two points are too far apart (which occurs when the hands become swapped or another hand appears abruptly), a line is not draw. This provides a cleaner output of motion tracking for a maximum of two hands.

Algorithm

Input video and output video handlers
Initialize 2 empty lists, to store previous hand-positions
For each frame grabbed:

  1. Convert frame to RBG
  2. Using pretrained hand-detection mp_hand_gesture, detect hands in frame
  3. Detect palm of hand, and add to appropriate hand-list
  4. Add point to curve of detected hand
  5. Draw curve of previous palm-locations
  6. Limit size of these lists to 75 data-points per hand
  7. Two points are considered sequential if they are within 75px of each other
  8. Display and Save Frame for output