Kinectセンサーからファイルに深度データを記録し、openNiを使用して再生しようとしています。私はopenNiの例に基づいて簡単なプログラムを書きました。Javaラッパーを使用しています。
問題は、記録している.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です。
誰かが私が間違っていることを知っていますか?