04. Hand Tracking + MediaPipe

Introduction

For this demo, you can follow along on this page, look at the demo file(s) available on the class Google Drive here

What is in the folder

The contents of the mediaPIPE folder are as follows:

  • toxes → package that you need
  • Media Pipe Touch Designer.toe → A default example with ALL tracking output (it will run very slow)
  • MediaPipe__justHANDS.toe → An example connecting the webcam, hand tracking and a circle to get you started.

What is MediaPipe?

MediaPipe is a collection of machine-learning tools from Google. Its vision tools can detect things such as hands, faces, and body positions in images or video.

For hands, it estimates 21 landmarks: points at the wrist, finger joints, and fingertips. Each point has position values that update as you move. TouchDesigner can use those numbers to control an image, animation, or effect.

MediaPipe diagram showing the 21 hand landmarks, from the wrist to each fingertip.

Diagram: Google, MediaPipe Hand Landmarker documentation.

For this exercise, we will use the MediaPipe TouchDesigner plugin by Torin Blankensmith and contributors. It brings the tracking tools into TouchDesigner. The downloaded project handles the tracking; our job is to decide what the numbers should control.

Downloads

You will need a supported Windows or Mac computer, a built-in or USB webcam, and enough light for the camera to see your hand. You shouldn't need to download this, but just in case, the information is below

MediaPipe plugin

  1. Open the plugin’s releases page. This guide uses v0.6.1: open that release.
  2. Under Assets, download release.zip. The automatically generated “Source code” archives are for development.
  3. Extract the ZIP into a project folder.
  4. Open MediaPipe TouchDesigner.toe from the extracted folder.
  5. Use File → Save As to save a working copy named hand_tracking_experiment.toe beside the original project. Keep the accompanying folders with it.

A .toe is a TouchDesigner project. A .tox is a reusable component. Begin with the included project so its components are already connected.

What the justHANDS file contains

  • webcam input
  • the mediapipe plugin + handtracking
  • a null showing the "raw" data
  • filter CHOPs to smooth the output from the webcam
  • math CHOPs to change the range of the data

What you may need to adjust or calibrate to your computer

  • the math CHOPs that adjust the ranges of the values, particularly x and y
  • flip or unflip your webcam

What else to try

  • Add another hand and use the "handedness" parameter to detect the "proper" hand
  • Use two hands together
  • Open up the default MediaPipe TouchDesigner.toe file and try something else like face tracking
  • Add a 3D shape
  • Use a more complex polygon or shape
  • Add "cool filters"

Extra Credit

There is no direct homework attached to this demo, however, especially if your project does not include hand tracking you may include a meaningfully (i.e. not simply changing the color of the circle) edited version of the justHANDS file for extra credit.