[英]How can I write a PCD file from Android Studio?
I want to write a PCD file in my android studio project (I have a Project Tango). 我想在我的android studio项目中写一个PCD文件(我有一个Project Tango)。
How can I do that? 我怎样才能做到这一点?
In the manifest I wrote: 在清单中我写道:
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
but I need to know how to write a *.pcd in the javas activity. 但我需要知道如何在javas活动中编写* .pcd。
Can someone help me? 有人能帮我吗?
AndroidManifest.xml file AndroidManifest.xml文件
//Permissions should be:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Code to write a *.PCD file 用于编写* .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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.