Skip to content

Hacked Fakenect to record and play Kinect stream using FREENECT_DEPTH_REGISTERED and FREENECT_VIDEO_RGB

License

Notifications You must be signed in to change notification settings

unitycoder/labicfakenect

 
 

Repository files navigation

labicfakenect

Hacked Fakenect to record and play Kinect stream using FREENECT_DEPTH_REGISTERED and FREENECT_VIDEO_RGB.


Install

Clone labicfakenect, create a directory for the build and use Cmake and make to configure the project.

cd labicfakenect
mkdir build
cd build
cmake ..
make
sudo make install

Use

Use the programlabicrecord to record in FREENECT_DEPTH_REGISTERED format. This will generate a folder in your_new_output_path with the Kinect dump.

labicrecord your_new_output_path

To play the recorded stream, use labicfakenect followed by the path to the recording, the path to the desired application and the optional app arguments.

labicfakenect your_new_output_path your_app_path your_optional_app_arguments

Manual mode (without labicfakenect wrapper)

The manual mode can be useful while using IDE's such as Eclipse, allowing you to debug your Kinect project using a recorded stream.

In the running configurations, set two environment variables: LD_PRELOAD, which points to the fakenect library built from this project (.so file) and FAKENECT_PATH, pointing to the path of the recorded stream.

Example:

LD_PRELOAD="/home/username/labicfakenect/build/lib/labicfakenect/libfreenect.so" FAKENECT_PATH="./example_set/" ./example_application

Reference: http://kinectdiary.blogspot.com.br/2011/02/using-fakenect.html


Fakenect

(c) 2010 Brandyn White bwhite@dappervision.com

See this blog post for more info http://brandynwhite.com/fakenect-openkinect-driver-simulator-experime

Description This consists of a "record" program to save dumps from the kinect sensor and a library that can be linked to, providing an interface compatible with freenect. This allows you to save data and repeat for experiments, debug problems, share datasets, and experiment with the kinect without having one.

Record ./record my_output // NOTE: output directory is created for you

The program takes one argument (the output directory) and saves the acceleration, depth, and rgb data as individual files with names in the form "TYPE-CURRENTIME-TIMESTAMP" where TYPE is either (a)ccel, (d)epth, or (r)gb, TIMESTAMP corresponds to the timestamp associated with the observation (or in the case of accel, the last timestamp seen), and CURRENTTIME corresponds to a floating point version of the time in seconds. The purpose of storing the current time is so that delays can be recreated exactly as they occurred. For RGB and DEPTH the dump is just the entirety of the data provided in PPM and PGM formats respectively (just a 1 line header above the raw dump). For ACCEL, the dump is the 'freenect_raw_tilt_state'. Only the front part of the file name is used, with the rest left undefined (extension, extra info, etc).

A file called INDEX.txt is also output with all of the filenames local to that directory to simplify the format (e.g., no need to read the directory structure).

Here is an example of using the program mkdir out sudo ./record out

And it will keep running, when you want to stop it, hit Ctrl-C and the signal will be caught, runloop stopped, and everything will be stored cleanly.

Library Use the resulting fakenect .so dynamically instead of libfreenect.

We read 1 update from the index per call, so this needs to be called in a loop like usual. If the index line is a Depth/RGB image the provided callback is called. If the index line is accelerometer data, then it is used to update our internal state. If you query for the accelerometer data you get the last sensor reading that we have. The time delays are compensated as best as we can to match those from the original data and current run conditions (e.g., if it takes longer to run this code then we wait less).

Build This is built with the main cmake script.

This gives you a build/lib/fakenect/libfreenect.so (note that it has the same name, but it is not the same) that you dynamically link in instead of libfreenect.so.

Evaluation There is a demo in wrappers/python, see the README there

Here is an example of calling the cython demo sudo LD_LIBRARY_PATH="../../../fakenect/" FAKENECT_PATH="thanksgiving0" python demo_cv_depth_show.py

Note the FAKENECT_PATH, you pass in the path to a directory made with "record"

About

Hacked Fakenect to record and play Kinect stream using FREENECT_DEPTH_REGISTERED and FREENECT_VIDEO_RGB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%