如何从 Android Studio 编写 PCD 文件?

How can I write a PCD file from Android Studio?

我想在我的 android 工作室项目(我有一个 Project Tango)中编写一个 PCD 文件。

我该怎么做?

我在清单中写道:

uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" 

但我需要知道如何在 javas 中编写 *.pcd activity。

有人可以帮助我吗?

AndroidManifest.xml 文件

//Permissions should be:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

写入 *.PCD 文件的代码

//Write to the sdcard in folder Documents:
out = new BufferedWriter(new FileWriter(new File(new File(Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_DOCUMENTS), filename));

//Write the header:
out.write(".PCD v.7 - Point Cloud Data file format\n" +
          "VERSION .7\n" +
          "FIELDS x y z\n" +
          "SIZE 4 4 4\n" +  //you only have 3 values xyz
          "TYPE F F F\n" +
          "COUNT 1 1 1\n" +
          "WIDTH "+ xyzIj.xyzCount "\n" +
          "HEIGHT 1\n" +
          "VIEWPOINT 0 0 0 1 0 0 0\n" +
          "POINTS " + xyzIj.xyzCount + "\n"
          "DATA ascii \n");

//Write the point cloud points by iterating over the XYZij buffer:
for (int i=0; i<=xyzIj.xyz.length-3; i+=3) {
  out.write(String.valueOf(xyzIj.xyz[i]) + " "); // separate the float values
  out.write(String.valueOf(xyzIj.xyz[i+1]) + " ");
  out.write(String.valueOf(xyzIj.xyz[i+2]) + "\n");
}

out.close();