Recovering truncated OpenNI ONI files

The open source OpenNI library for RGB-D cameras, like Microsoft Kinect, allows to record and playback streams of color and depth content. These streams are stored into a structured file with ONI extension.

If the recording application (such as NiViewer or your own) crashes the resulting ONI file results invalid and it is not readable by OpenNI.

Starting from the source code of the OpenNI2 I have prepared a minimal Python script that tries to fix the ONI file:
  • Truncate the file if the last Record is incomplete
  • Append a RECORD_END if it is missing
  • Fix the starting header with the maximum node identifier
 The Python script is available here.

Update: the tool eventually evolved in a more general tool for manipulating ONI files. Github repo.


Popular posts from this blog

Docker for our ROS robotic overlords

cmakego: Simpler access to external libraries in CMake

Algebrical Data Types in C++