Processing and Kinect – Replaying Recorded Kinect Data for Development

This uses the format from Peizhao.

First, get the code by cloning the repository at http://github.com/rhema/art . (look up git or github if you need to)

The folder we are interested with here is processing/sandbox/communication.

This folder contains the files:

./data/DirectIndirectRawData.txt   Kinect data from a raw (ascii values) format that we don’t use anymore.
./data/kinect_indirect_slower.bin  Kinect data from binary format.  If you want to know about the format, look at our discussion on github.
./udp/processing_consumer/consume_udp/consume_udp.pde   Example listener and visualizer in processing.
./udp/python_udp_simulator/load_data.py   Opens files in /data.
./udp/python_udp_simulator/simulate.py   The file you want to run to generate UDP data.

To run, run /udp/python_udp_simulator/simulate.py.  This starts the UDP traffic.  Then, open consume_udp.pde in processing (I used 2.5>).  You should see this:

The processing file has some comments.  The way that you might use it in a project is to copy this as a file in your sketch.  You could use the variables that get updated below directly:

PVector root_position = new PVector(0,0,0);
Vector<PVector> all_positions = new Vector<PVector>(21);//raw kinect data
Vector<PVector> all_positions_p = new Vector<PVector>(21);//converted to 2d

all_positions_p contains screen coordinates.   You need to make sure you don’t write to all_positions or all_positions_p or you may run into synchronization issues.

Or, you could call a different function from the within function dancerPositionAlteredEvent.

Please comment if you have questions and I will revise this post.

Leave a Reply

Your email address will not be published. Required fields are marked *