I am programming in C++ and have been able to save a .oni depth file for testing purposes using OpenNI2.
I am now however unable to load this .ONI file back into a program to use. My code used is as follows:

Status rc_ = openni::STATUS_OK;

Device device_;

rc_ = OpenNI::initialize();

char* fileaddress = “C:\Users\James\DepthRecording1.oni”;

rc_ =;

After the .open line has been executed, rc_ has the following status : STATUS_NO_DEVICE.

This is however the method of loading files as specified in the OpenNI2 documentation, and this code is proven to work if file address is switch for “openni::ANY_DEVICE”, in which case it loads my 3D camera (Orbbec Astra).

Does anyone know what needs to be changed/ added in order to be able to load the file?

Try escaping the backslashes \\ or using forward slashes /.

Changing the \\ to / gives the same result of not being able to detect the device.
Is there another format, perhaps in which individual frames can be saved, so that all the same data will be kept except it can be loaded in a different way?

ONI recording and playback does work in general. There’s nothing special about it for Astra. Are you setting the depth or color stream mode to a resolution, fps, or format that isn’t in the file? Try not calling setVideoMode() if device.isFile() is true. Also triple-check the file is actually at the specified path and the capitalization is correct.

Other than that, you’re of course free to define your own format for saving and loading data.