深度感知

来源:互联网 发布:萨德问题 知乎 编辑:程序博客网 时间:2024/05/18 21:09

Unity How-go Guide: Depth Perception

These instructions will get you up and running with a simple point cloudapplication in Unity, intended for Unity developers of any experience level.You'll build a simple scene in Unity, import the Tango functionality,and attach prefabs that get the depth sensor data and display it as you movethe Tango device around.

For more experienced Unity developers, you may also want to review the codesamples in GitHub andthe SDK Reference Documentation.

Unity方法指南:深度感知

这些说明将使您在Unity中使用简单的点云应用程序,并为Unity开发人员提供任何经验级别。您将在Unity中构建一个简单的场景,导入Tango功能,并附加预制,获得深度传感器数据和显示它,当你移动探戈设备。

对于更有经验的Unity开发人员,您可能还需要查看GitHub和SDK参考文档中的代码示例。

Preliminary steps

  1. If you haven't set up your computer to develop with Tango in Unity yet, see Getting Started With Unity.

  2. Go to the Setup for All Unity Tango Apps page and perform the basic setup operations on that page. When you have finished, return to this page and continue on with the steps below.

初步步骤

     如果您尚未在Unity中设置您的计算机与Tango一起开发,请参阅Unity入门。

     转到“所有Unity Tango应用程序的设置”页面,并在该页面上执行基本设置操作。 完成后,返回此页面,继续执行以下步骤。

Add prefabs to your Hierarchy

You'll need the Tango Point Cloud and Tango Delta Camera prefabs.

If you're not familiar with Prefabs, see theUnity documentation on them.

  1. In the Project panel, click TangoPrefabs to view the contents of that folder.
  2. Drag the Tango Point Cloud prefab (rainbow box icon) into theHierarchy panel.
  3. Drag the Tango Delta Camera prefab (frustrum icon) into the Hierarchy panel.

向您的层次结构添加预制件

你需要探戈点云和探戈三角洲相机预制。

如果你不熟悉Prefabs,请参阅关于它们的Unity文档。

     在“项目”面板中,单击TangoPrefabs以查看该文件夹的内容。
     将Tango Point云预制(彩虹框图标)拖动到层次结构面板中。
     将Tango Delta Camera预制(frustrum图标)拖动到“层次”面板中。

Enable depth in the Tango Manager  在Tango管理器中启用深度

  1. In the Hierarchy panel, select the Tango Manager prefab.
  2. In the Inspector, select Enable Depth in theTango Application (Script) component.

Enable mesh rendering to update the point cloud 启用网格渲染以更新点云

  1. In the Hierarchy panel, select the Tango Point Cloud prefab.
  2. In the Inspector, select the checkbox to the left of Mesh Renderer.
  3. In the Tango Point Cloud (Script) component, select Update Points Mesh.

Build and run your project

  1. On the File menu, click Build and Run.
  2. In the Build Settings dialog, click Build and Run.
  3. In the Build Android dialog, enter a name in the Save As field, and then clickSave.

After the build bar clears, Unity launches your application on the ProjectTango device. Walk around with your device, and see it render the Point Cloudof what it sees!

在构建栏清除后,Unity在ProjectTango设备上启动您的应用程序。用你的设备走动,看到它渲染点云,它看到什么!

Set the background color to black (optional)

You currently have the Tango Delta Camera set to use aSkybox. For most simpleapplications this is fine, but for viewing a point cloud, you may want to setyour background to a darker color so the point cloud points will render moreclearly.

您目前已将Tango Delta相机设置为使用Skybox。对于大多数简单应用,这是很好的,但是对于查看点云,您可能需要将背景设置为更深的颜色,因此点云点将渲染得更清晰。

  1. In the Hierarchy panel, expand the Tango Delta Camera prefab's foldout arrow to show its children, includingMulti Camera, and select the Multi Camera game object by clicking it.
  2. In the Inspector panel, change the value of the Clear Flags dropdown menu fromSkybox to Solid Color.
  3. Click the Background box below that (which by default should be white). AColor window opens; inside that window, use the color controls to select a dark color, preferably black.

Disable the Trail Renderer (optional)

As you move around with your device, a blue line is drawn along its path in3D space. This line is drawn by a child of the Tango Delta Prefab calledTrail. If you don't want to display the line, here's how to disable it:

随着您的设备移动,在3D空间中沿其路径绘制一条蓝线。此线由Tango Delta Prefab的名为Trail的孩子绘制。 如果你不想显示行,以下是如何禁用它:

  1. In the Hierarchy panel, expand Tango Delta Camera to show its children, and then clickTrail.
  2. In the Inspector panel, deselect the Trail gameObject.
  3. Build and run.

0 0