Main issues with TouchLib and the similars
TouchLib and similar libraries for multi-touch solutions are using camera input to identify where the user touches a table. The blobs are either shadow cast on the surface from lighting above, or reflection from Infrared sources below the table.
The big benefit of TouchLib is that it is relative cheap. All you need to build a Touch table is a (modified) web can, some software and a computer.
The main issue with TouchLib is this:
- It can not distinguish artifacts from your fingers – Where artifacts can be light sources or shadows appearing as blobs
Using the 3D info from Microsoft Kinect, it should be possible to build a reliable Multi-touch table, using 3D points as input.
Blobs are items in 2D or 3D space.
This Processing demo uses the Kinect Point Cloud to present bubbles, representing the person behind the camera. That code will be my starting point.
The Kinect projects a grid of 640 x 420 Infrared (IR) dots into the space it is in. These dots are hitting objects in that space and the reflection is recorded and translated by the Kinect device. The result is called a “point cloud”.
Retrieving fingers from Point clouds
Point clouds are “clouds of points” representing the locations where the IR dots are reflected by objects in space.
You can start finding fingers “pressing a table” using those Point clouds.
This is done by two basic steps:
- Optimizing scanning to reduce overhead – You do not want to scan all points in the Point Cloud. You only want the points that matter.
- Only reacting to “fingers” after a certain treshold – As “fingers” can be any pointy item in a room, we only want to measure them within a specific proximity to our table.
Reducing overhead by using heat maps and proximity grids
I want the library to be fast. This means that it will skip as many steps as possible when processing the 3D data from the Kinect camera.
The less 3D points I have to scan to find out where fingers are in the 3D space, the faster the process will be and the less resources it will take form the computer. Leaving space for other applications to do their work.
Therefore the process described below.
The first scan will divide the Kinect Point Cloud into a grid of 5 x 4 points, each covering 100 pixels. In each grid, one point will be measured.
Based on the proximity of the point, a proximity “heat map” is created. The closer a point, the “hotter” it is.
The “hottest” points are representing objects in closest proximity – which are most interesting for us.
Each “hot” cell from the first scan will be divided into a new grid, where we sample in more detail what is going on.
Resulting in the “Heat map detail”.
Overhead is reduced by:
- Creating a rough overview – By only scanning a limited set of points we can get a quick indication where objects might be. As hands and bodies are usually big enough to cover multiple 3D points, we can identify them easily enough
- Skipping the “cells” we do not need – For instance because objects are outside our proximity range
- Only zooming into the most interesting parts – By taking the “hottest” points from the initial scan
- Repeating step 2 until we are satisfied – Due to the amount of detail we really need to be sure
Refining the scans by prediction
- Only a limited amount of scans needed to pinpoint the object – From very course scans we can find the reflected dots from body parts. By following these parts we can limit the scans to those areas to find how they stick out towards the camera
- Increased reliability when we proceed – As the first scan is based on a rough matrix, we might miss a finger in cell “A1” which is part of the hand that is measured in cell “A2”. Once we know where the hand is in “A2” we can project a field around the center of that “hand” and scan for limbs which might be in the surrounding area
Calibrating the table
Moving it further: Using blobs and proximity for a simplified Minority Report interface
- Blobs and their relationship to each other – Are they close to each other? What is the angle or rotation between them?
- The distance of each blob related to the camera – Are they close or far away?
- “Contact” – Are we doing a “mouse over” or really “grabbing” an object?
- “Speed” – By “dialling” the hand we change the rotation of the two fingers on each hand. The bigger the rotation of the hand, the bigger the speed
- “Direction” – Dialling left will move objects to the left, dialling to the right will move them to the right. Dialing can also induce zooming in / out.
- “Pressure” – Moving your hands closer and further away from the camera can increase and decrease “pressure” on an object, or can lead to tilting of an object.
- Moving objects around – Once you “grab” objects with the fingers and move the hand, you can move the object