简体   繁体   English

如何从Android Studio编写PCD文件?

[英]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.

相关问题 有什么办法可以从 Android Studio 向 json 写入数据吗? - Is there any way I can write data to json from Android Studio? 如何在Android Studio的If语句中编写“如果单击了if按钮”? - How can I write “if button clicked” in an If statement in android studio? 如何在Android Studio中使用SQLite编写注册和登录系统? - How can I write a registration & login system with SQLite in Android Studio? 如何在Android Studio中编写波斯语? - How can I write Persian language in Android Studio? 如何从另一个文件使用文件中的对象(Android Studio) - how I can use object in my file from another file (Android Studio) 如何将我在后台从 logcat 获得的位置信息打印到 Android Studio 中的文本文件? - How can I print the location information I get in the background from logcat to a text file in Android Studio? 如何将整数从Java文件发送到XML文件夹? (Android Studio) - How can I send a integer from my Java file to my XML folder? (Android Studio) 如何从 android studio 中的 pdf 或 excel 文件导入联系人号码? - How can i import contact numbers from a pdf or excel file in android studio? Android:如何写入文件并在之后将其读入数组 - Android: How can I write to a file and read it into an array afterwards 如何将每个数据保存在 JSON 文件中? 安卓工作室 - How can I save every data in JSON file? android studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM