Copyright (c) 2005-2026 Martin Kaltenbrunner. This software is part of reacTIVision, an open source fiducial tracking and multi-touch framework based on computer vision. For further information on the TUIO protocol and framework, please visit TUIO.org
You can download the release packages of this library from GitHub Releases, and retrieve its latest source code from the GitHub repository.
This package contains two demo sketches and a library which allows Processing to receive TUIO messages via UDP from any TUIO enabled tracker. The TuioDemo sketch graphically displays the object and cursor states on the screen. You can use this demo as a starting point for the development of your own Processing sketch based on the TUIO framework. Please refer to the source code of the example and the following section for further details on its usage.
Keep in mind to make your graphics scalable for the varying screen and window resolutions. A reasonable TUIO application will run in fullscreen mode, although the windowed mode might be useful for debugging purposes or working with the TUIO Simulator.
After the library has been accepted as a Processing contribution, it can be installed directly from the Contribution Manager via Sketch → Import Library → Add Library... by searching for TUIO Client.
For manual or direct installation, download TUIO.zip or TUIO.pdex from GitHub Releases. Processing 4.2 and later can install the .pdex file directly. Otherwise, unzip TUIO.zip and move the uncompressed TUIO folder to the libraries directory of your Processing sketchbook. In order to use this library, you will need to provide the according import statement within the header of your Processing sketch:
import TUIO.*;
This library is pure Java and has no native dependencies. It targets Java 8 and is intended for Processing 3.0 or later, including Processing 4. The release packaging and both example sketches were compile-tested with Processing 4.5.8 on macOS. Receiving messages requires UDP network access to the configured TUIO port, which is 3333 by default.
First you need to create an instance of the TuioProcessing client, providing the instance of your sketch to the constructor using the this argument. The TuioProcessing client immediately starts listening to incoming TUIO messages and generates higher level events based on the object and cursor movements.
TuioProcessing tuioClient = new TuioProcessing(this);
By default the client listens on the default TUIO port 3333 on the loopback interface only. You can specify a different port with TuioProcessing(this, port), and in order to also receive TUIO messages from remote senders on the network you can provide a bind address with TuioProcessing(this, port, host) — use "0.0.0.0" to listen on all network interfaces.
TuioProcessing tuioClient = new TuioProcessing(this, 3333, "0.0.0.0");
Therefore your sketch needs to implement the following methods in order to be able to receive these TUIO events properly:
- addTuioObject(TuioObject tobj) this is called when an object becomes visible
- updateTuioObject(TuioObject tobj) an object was moved on the table surface
- removeTuioObject(TuioObject tobj) an object was removed from the table
- addTuioCursor(TuioCursor tcur) this is called when a new cursor is detected
- updateTuioCursor(TuioCursor tcur) a cursor was moving on the table surface
- removeTuioCursor(TuioCursor tcur) a cursor was removed from the table
- addTuioBlob(TuioBlob tblb) this is called when a new blob is detected
- updateTuioBlob(TuioBlob tblb) a blob was moving on the table surface
- removeTuioBlob(TuioBlob tblb) a blob was removed from the table
- refresh(TuioTime frameTime) this method is called after each bundle, use it to repaint your screen for example
Each TuioObject, TuioCursor or TuioBlob is identified with a unique SessionID, which it maintains over its lifetime. Additionally each TuioObject carries a SymbolID that corresponds to its attached fiducial marker number. The CursorID of the TuioCursor is always a number in the range of all currently detected cursors. You can retrieve these ID numbers with the according getSessionID(), getSymbolID() or getCursorID() methods.
The TuioObject, TuioCursor and TuioBlob references are updated automatically by the TuioProcessing client and are always referencing the same instance over the object's or cursor's lifetime. All the TuioObject, TuioCursor and TuioBlob attributes are encapsulated, and can be accessed with methods such as getX(), getY() and getAngle(). There exist further methods for the retrieval of speed and acceleration values, please see the provided example sketches for a complete list. TuioObject, TuioCursor and TuioBlob also have some additional convenience methods for the calculation of distances and angles between objects. The getPath() method returns an ArrayList of TuioPoint representing the movement path of the object. Please refer to the documentation of the TUIO Java reference implementations for further details on all the available methods.
Alternatively, the TuioProcessing class contains some methods for the polling of the current object and cursor states. There are methods which return either a list or individual TuioObject, TuioCursor and TuioBlob objects.
- getTuioObjectList() returns an ArrayList of all currently present TuioObjects
- getTuioCursorList() returns an ArrayList of all currently present TuioCursors
- getTuioBlobList() returns an ArrayList of all currently present TuioBlobs
- getTuioObject(long s_id) returns a TuioObject (or NULL if not present)
- getTuioCursor(long s_id) returns a TuioCursor (or NULL if not present)
- getTuioBlob(long s_id) returns a TuioBlob (or NULL if not present)
The getTuioClient() method provides access to the underlying TuioClient instance for advanced use cases, such as source filtering in multi-source setups or the optional One Euro filtering of position, angle and blob size values.
The library is built with Maven and targets Java 8, so it remains compatible with Processing 3 and 4:
mvn package
This compiles the TuioProcessing wrapper class and builds library/TUIO.jar, which is packaged together with the bundled library/libTUIO.jar reference implementation. The build also creates the Processing release artifacts in the target directory:
- TUIO.zip installable library archive
- TUIO.txt contribution metadata copied from library.properties
- TUIO.pdex direct-install archive for Processing 4.2 and later
The integer version in library.properties must be incremented for every published update, while prettyVersion and the Maven version in pom.xml must match the intended semantic version. After verifying the artifacts with mvn clean package, create and push a tag named vX.Y.Z (for example v1.1.6). The GitHub release workflow checks that the tag, Maven version and prettyVersion agree, rebuilds the artifacts, verifies their layout and attaches TUIO.txt, TUIO.zip and TUIO.pdex to the GitHub release.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
This Processing library is based on the TUIO Java reference implementation, which includes a self-contained OpenSound Control codec in the TUIO.osc package.