Touching Source Documentation



This is the source code documentation of Touching, the multitouch recognition and processing library written at the TU-Berlin during a multitouch student project in winter 2007/2008. For more information about it, check also our wiki:

class diagram

The following diagram shows the most important classes with very brief descriptions. On the left side are the image sources (from camera or any other source). Located on the right side are some preprocessing devices which may contain filters. A device contains an image producer as source and a tracker to deliver the images to. The device gets a set of touches for the current frame from the tracker and calls touch listener for each touch and frame listener for each frame processed. Those listeners do further processing on retreived data: Send it over the network or process it further locally.

In the center of the diagram below are five central pure interface classes arranged (prefixed by a capital i).


A Example for a client app

It contains preprocessor macros (OSC_AVAIL) to decide whether to use our own protocol or the TUIO/OSC protocol to receive touches.
For a simple test it is sufficient to chose either of them.

//#define OSC_AVAIL

#ifdef OSC_AVAIL
        #include <devices/OSCNetworkDevice.h>
        #include <devices/NetworkMultiTouchDevice.h>

#include <interfaces/ITouchListener.h>
#include <util/Touch.h>
#include <util/global.h>

#include <iostream>

using namespace Touching;

class MyListener : public ITouchListener {
    void onTouchDown(const Touch& touch) { std::cout << "Down: " << touch << std::endl; }
    void onTouchUp(const Touch& touch) { std::cout << "Up:   " << touch << std::endl; }
    void onTouchMove(const Touch& touch) {std::cout << "Move: " << touch << std::endl; }


MyListener client;

#ifdef OSC_AVAIL
        Touching::OSCNetworkDevice* netDevice = 0;
        Touching::NetworkMultiTouchDevice* netDevice = 0;

void onInit(uint port) {
    std::cout << "  Start listening on port " << port << "." << std::endl;

#ifdef OSC_AVAIL
    netDevice = new Touching::OSCNetworkDevice(port);
        netDevice = new Touching::NetworkMultiTouchDevice(port);



void onIdle() {
#ifdef OSC_AVAIL
        // nothing OSC uses multithreading


int main(int argc, char * argv[])
    uint port = 3333;
    if( argc > 1 ){
        port = (uint)atoi( argv[1] );
    std::cout << "Usage: " << argv[0] << " <port number to listen on>" << std::endl;


    return 0;

Generated on Sat May 31 12:19:42 2008 for Touching by  doxygen 1.5.5