1
我试图将Kinect传感器的深度数据记录到文件中,然后使用openNi进行播放。 我写了一个基于openNi实例的简单程序。我使用java包装。使用OpenNI录制和阅读oni文件时出现问题。
的问题是,当我尝试阅读,我录制到.oni文件,我得到这个错误:
org.OpenNI.StatusException: The file is corrupted!
这里是我的记录代码:
Context context = new Context();
// add the NITE License
License license = new License("PrimeSense", "0KOIk2JeIBYClPWVnMoRKn5cdY4="); // vendor, key
context.addLicense(license);
DepthGenerator depth = DepthGenerator.create(context);
Recorder recorder = Recorder.create(context, "oni");
context.createProductionTree(recorder.getInfo());
recorder.setDestination(RecordMedium.FILE, "KinectLog.oni");
recorder.addNodeToRecording(depth);
context.startGeneratingAll();
int tmp = 0;
while(tmp < 100){
tmp++;
context.waitAnyUpdateAll();
recorder.Record();
System.out.println("recording");
}
也许我必须在录制后通过调用一些.release()方法来清理?记录器没有这样的方法。
这里是我打.oni文件代码:
Context context = new Context();
// add the NITE License
License license = new License("PrimeSense", "0KOIk2JeIBYClPWVnMoRKn5cdY4="); // vendor, key
context.addLicense(license);
context.openFileRecordingEx("KinectLog.oni");
就这么注塑StatusException的openFileRecordingEx。
任何人都知道我在做什么错了?