1

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

    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.onisample 中的结果时NiViewer,我得到:

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

可能是什么问题呢?

4

1 回答 1

1

我找到了,我忘了做:

recorder->Release();
delete recorder;

在最后。

于 2012-10-15T06:11:16.440 回答