TUIO_JAVA Client in Matlab for reading the position and orientation of objects detected in reacTIVision

Download the JAVA TUIO client from http://mtg.upf.es/reactable/?software

Open the file in your Matlab install directory matlab_home_dir/toolbox/local/classpath.txt and append a line corresponding to the path to the JAR file of the TUIO Client:

install_directory/TUIO_JAVA/TuioDemo.jar 

* for more information about Java and Matlab, see: http://www.weizmann.ac.il/matlab/techdoc/matlab_external/ch_java.html

Open Matlab and run the script below while executing the reacTIVision software:

tc = TuioClient();
tc.connect();

a = zeros(1,100000);
x = a;
y = a;
t = a;

for i = 1 : 100000
while (tc.getTuioObjects().size() == 0)
end;

a(i) = tc.getTuioObjects().get(0).getAngle();
x(i) = tc.getTuioObjects().get(0).getPosition().getX();
y(i) = tc.getTuioObjects().get(0).getPosition().getY();
t(i) = tc.getTuioObjects().get(0).getUpdateTime();
pause(0.001);
end;

tc.disconnect()
quiver(x,y,cos(a),sin(a))

 

The quiver command will plot arrows indicating the position and orientation of the tracked object from reacTIVision.

If you are using a fisheye lens camera (like the AXIS 212), then you need to calibrate the reacTVIsion software so that it produces correctly the position of objects. You can use the file http://mtg.upf.es/reactable/data/rectglr_calibration.pdf

for calibration or even mark the table you are using for your experiments (table_calibration.jpeg).

AttachmentSize
table_calibration.jpeg34.12 KB