kinectと組み合わせて処理を使用して、ポイントクラウドデータをキャプチャしています。私のスケッチは、kinectから配列にポイントのベクトル位置を書き込み、PrintWriterクラスを使用して、各フレームのすべてのポイントを個別のテキストファイルに格納するテキストファイルを作成します。これには、プリントライターによる書き込みを停止することになっている条件が含まれていますが、書き込みを続行し、最終的には電話を切ります。何が間違っているのかについてのアイデアはありますか?これが私のコードです:
録音時:
PVector realWorldPoint; //stores each point as a vector
PVector[] frame = new PVector[arrayLength]; //stores all of the vectors/real world points in an array
int index = 0;
for(int y=0;y < context.depthHeight();y+=steps) //height = 480
{
for(int x=0;x < context.depthWidth();x+=steps) //width = 640
{
if (isRecording == true){
int offset = x + y * context.depthWidth();
realWorldPoint = context.depthMapRealWorld()[offset];
frame[index] = realWorldPoint;
recording.add(frame);
index++;
}
}
}
そして保存するとき:
if (isRecording == true){
isRecording = false;
println("Stopped Recording");
Enumeration e = recording.elements();
int i = 0;
while (e.hasMoreElements()) {
// Create one directory
boolean success = (new File("out"+currentFile)).mkdir();
PrintWriter output = createWriter("out"+currentFile+"/frame" + i++ +".txt");
PVector [] frame = (PVector []) e.nextElement();
for (int j = 0; j < frame.length; j++) {
output.println(j + ", " + frame[j].x + ", " + frame[j].y + ", " + frame[j].z );
}
output.flush(); // Write the remaining data
output.close(); //Doesn't seem to close
}
println("done recording"); //NEVER EXECUTES
}
これらは大きなファイル(1個あたり約12,000行)であり、私はこれらを1秒間に約30行作成しています。多分それは単にそれをオーバーロードしているので、ストップは決して登録されませんか?また、列挙についてはわかりません。これは他の誰かのコードからコピーされたものですが、このデータ型に関するドキュメントはありません。