GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ARCore
  • Geospatial Creator for Unity
  • Documentation
  • Reference
  • What's New in ARCore
  • Supported devices
  • Downloads
  • AR codelabs
  • Sample apps
  • Video: What's under the hood in ARCore
  • Fundamental concepts
  • Working with anchors
  • Augmented reality design guidelines
  • Environment

This view

  • Original page
  • New address

GeezerVison is showing developers.google.com — Depth API quickstart for Android NDK | ARCore | Google for Developers

Depth API quickstart for Android NDK Stay organized with collections Save and categorize content based on your preferences.

Spark icon

Page Summary

  • This guide shows you how to set up your development environment and try out occlusion and visualize the depth map using a sample Depth API app.

  • To follow along, you need Android Studio 3.1 or higher, a supported Android device, and a basic understanding of Android development and the Depth API.

  • The sample project uses OpenGL for rendering 2D and 3D graphics and requires you to enable ARCore.

  • You can run the sample app on a physical supported device to place virtual Android figures and toggle occlusion or visualize the depth map.

  • Set up your development environment for Depth API
  • Try out occlusion and visualize the depth map in a sample app

Prerequisites

  • Android Studio version 3.1 or higher with Android SDK Platform version 7.0 (API level 24) or higher
  • An Android device that supports the Depth API. See the list of ARCore supported devices for details.
  • A basic understanding of Android development. If you are new to Android, see Building your first Android app for beginners.
  • A basic understanding of the Depth API. If you are new to working with Depth, see the Depth API introduction.

Open the sample project

This quickstart uses OpenGL, a programming interface for rendering 2D and 3D vector graphics. Review Enable ARCore before getting started with the following steps.

Get the sample project by cloning the repository with the following command:

git clone https://github.com/google-ar/arcore-android-sdk.git

In Android Studio, open the hello_ar_c sample project.

Run the sample

The Depth API sample app lets you place virtual Android figures in your environment, and toggle occlusion to see the difference. It also lets you toggle the depth map visualization in a given space.

Note: The Depth API is not supported when running in the Android Emulator. Use a physical supported device to test the Depth API.

Make sure your Android device is connected to the development machine and click Run in Android Studio.

Your device may prompt you to install or update Google Play Services for AR if it is missing or out of date. Tap CONTINUE to install it from the Google Play Store.

Enable depth

The first time you run the app and place an Android figure, a dialog will prompt you to enable depth. It only appears the first time the app is run, for the first Android placed. Tap Enable to add occlusion.

Toggle occlusion and a visualization of the depth map

Tap the gear icon to toggle occlusion and a visualization of the depth map. Select Enable depth to enable occlusion. Select Show depth map to display a visualization of the depth map on the device's screen.

For example, the following images show a virtual Android figure in a real space containing a trunk beside a door. In the first image, the virtual Android unrealistically overlaps with the edge of the trunk. In the second image, the Android is properly occluded, appearing much more realistic in its surroundings.

The following images show a camera image of a hallway with a bicycle on the wall, and a visualization of the depth map that is created for that camera image.

Next steps

Start using the Depth API in your own apps. To learn more, see:

  • Depth API overview for Android NDK
  • Depth API developer guide for Android NDK
  • ARCore SDK for Android NDK API reference

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.