使用OpenNI记录Kinect深度的问题 - “文件已损坏!”

时间:2012-10-14 22:05:22

标签: kinect recording openni

这是我在我的应用中设置录音的方式:

    xn::NodeInfoList recordersList;
    rc = context.EnumerateProductionTrees(XN_NODE_TYPE_RECORDER, NULL, recordersList);
    CHECK_RC(rc, "enumerate recorders");
    xn::NodeInfo chosen = *recordersList.Begin();

    recorder = new xn::Recorder();
    rc = recorder->Create(context, "oni");
    CHECK_RC(rc, "create recorder");
    rc = context.CreateProductionTree(chosen, *recorder);
    CHECK_RC(rc, "create production tree");
    rc = recorder->SetDestination(XN_RECORD_MEDIUM_FILE, "KinectLog.oni");
    CHECK_RC(rc, "set destination for recording");
    rc = recorder->AddNodeToRecording(depthGenerator, XN_CODEC_16Z_EMB_TABLES);
    CHECK_RC(rc, "add node to recording");

然后我每秒致电rc = context.WaitAnyUpdateAll();约30次;一切正常,我可以在屏幕上看到Kinect输入等。

一切似乎都没问题,但当我尝试在示例KinectLog.oni中打开结果NiViewer时,我得到:

jan@mbp ~/OpenNI/Samples/Bin/x64-Release $ ./NiViewer ~/devel/k/KinectLog.oni
Open failed: The file is corrupted!
Press any key to continue . . .

可能是什么问题?

1 个答案:

答案 0 :(得分:1)

我找到了,我忘记了:

recorder->Release();
delete recorder;

最后。