البدء السريع لواجهة برمجة التطبيقات Depth API لـ Android NDK
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
إعداد بيئة التطوير لواجهة Depth API
يمكنك تجربة التظليل ومشاهدة خريطة العمق في نموذج تطبيق.
المتطلبات الأساسية
استوديو Android
الإصدار 3.1 أو الإصدارات الأحدث مع الإصدار 7.0 من "منصة حزمة تطوير البرامج (SDK) لنظام التشغيل Android" (مستوى واجهة برمجة التطبيقات 24)
أو أعلى
في "استوديو Android"، افتح نموذج المشروع hello_ar_c.
تنفيذ النموذج
يتيح لك نموذج تطبيق Depth API وضع أشكال افتراضية من Android في
وتبديل نظام التظليل لمعرفة الفرق. كما يتيح لك التبديل
تصور خريطة العمق في مساحة معينة.
تأكد من اتصال جهاز Android بجهاز التطوير وانقر على
Run في "استوديو Android".
قد يطلب منك جهازك تثبيت التطبيق أو تحديثه.
خدمات Google Play للواقع المعزّز
إذا كان مفقودًا أو قديمًا. انقر على CONTINUE لتثبيته من خلال
"متجر Google Play".
تفعيل العمق
عند تشغيل التطبيق لأول مرة ووضع شكل Android، سيظهر مربع حوار
عليكم لتفعيل العمق. ولا يظهر هذا التحديث إلا في المرة الأولى التي يتم فيها تشغيل التطبيق،
وضع Android لأول مرة. انقر على Enable لإضافة تأثير التظليل.
تبديل التظليل ومؤثرات عرض خريطة العمق
انقر على رمز الترس لتبديل التظليل وتصوير خريطة العمق.
اختَر Enable depth لتفعيل ميزة التظليل. اختيار Show depth map من أجل
عرض تصور لخريطة العمق على شاشة الجهاز.
على سبيل المثال، تُظهر الصور التالية شكل Android افتراضيًا في مساحة حقيقية.
تحتوي على صندوق بجانب الباب. في الصورة الأولى، يمثّل ابتكارًا
تتداخل بشكل غير واقعي مع حافة الجذع. في الصورة الثانية،
إظلام نظام Android محجوبًا، ويبدو أكثر واقعية في
المحيطة به.
تعرض الصور التالية صورة كاميرا لممرّ مع دراجة على
وتصور لخريطة العمق التي تم إنشاؤها لتلك الكاميرا
.
الخطوات التالية
ابدأ استخدام واجهة برمجة التطبيقات Depth API في تطبيقاتك الخاصة. لمزيد من المعلومات، يُرجى الاطّلاع على:
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eLearn to set up your development environment to use the ARCore Depth API for Android.\u003c/p\u003e\n"],["\u003cp\u003eExplore a sample app demonstrating occlusion and depth map visualization with virtual objects in real-world environments.\u003c/p\u003e\n"],["\u003cp\u003eUnderstand the prerequisites, including a supported Android device and basic Android development knowledge.\u003c/p\u003e\n"],["\u003cp\u003eRun the provided sample project to experience the Depth API's effects on virtual object placement and realism.\u003c/p\u003e\n"],["\u003cp\u003eAccess further resources to integrate the Depth API into your own Android applications.\u003c/p\u003e\n"]]],[],null,["# Depth API quickstart for Android NDK\n\n- Set up your development environment for Depth API\n- Try out occlusion and visualize the depth map in a sample app\n\nPrerequisites\n-------------\n\n- [Android Studio](https://developer.android.com/studio/) version 3.1 or higher with Android SDK Platform version 7.0 (API level 24) or higher\n- An Android device that supports the Depth API. See the list of [ARCore supported devices](/ar/discover/supported-devices) for details.\n- A basic understanding of Android development. If you are new to Android, see [Building your first Android app for beginners](https://developer.android.com/training/basics/firstapp/).\n- A basic understanding of the Depth API. If you are new to working with Depth, see the [Depth API introduction](/ar/develop/depth).\n\nOpen the sample project\n-----------------------\n\nThis quickstart uses [OpenGL](https://en.wikipedia.org/wiki/OpenGL), a\nprogramming interface for rendering 2D and 3D vector graphics. Review\n[Enable ARCore](/ar/develop/java/enable-arcore) before getting started with the\nfollowing steps.\n\nGet the sample project by cloning the repository with the following command: \n\n```\ngit clone https://github.com/google-ar/arcore-android-sdk.git\n```\n\nIn Android Studio, open the **hello_ar_c** sample project.\n\nRun the sample\n--------------\n\nThe Depth API sample app lets you place virtual Android figures in your\nenvironment, and toggle occlusion to see the difference. It also lets you toggle\nthe depth map visualization in a given space.\n| **Note:** The Depth API is not supported when running in the Android Emulator. Use a physical [supported device](/ar/discover/supported-devices) to test the Depth API.\n\nMake sure your Android device is connected to the development machine and click\n**Run** in Android Studio.\n\nYour device may prompt you to install or update\n[Google Play Services for AR](https://play.google.com/store/apps/details?id=com.google.ar.core)\nif it is missing or out of date. Tap **CONTINUE** to install it from the\nGoogle Play Store.\n\nEnable depth\n------------\n\nThe first time you run the app and place an Android figure, a dialog will prompt\nyou to enable depth. It only appears the first time the app is run, for the\nfirst Android placed. Tap **Enable** to add occlusion.\n\nToggle occlusion and a visualization of the depth map\n-----------------------------------------------------\n\nTap the gear icon to toggle occlusion and a visualization of the depth map.\nSelect **Enable depth** to enable occlusion. Select **Show depth map** to\ndisplay a visualization of the depth map on the device's screen.\n\nFor example, the following images show a virtual Android figure in a real space\ncontaining a trunk beside a door. In the first image, the virtual Android\nunrealistically overlaps with the edge of the trunk. In the second image,\nthe Android is properly occluded, appearing much more realistic in its\nsurroundings.\n\nThe following images show a camera image of a hallway with a bicycle on the\nwall, and a visualization of the depth map that is created for that camera\nimage.\n\nNext steps\n----------\n\nStart using the Depth API in your own apps. To learn more, see:\n\n- [Depth API overview for Android NDK](/ar/develop/c/depth/overview)\n- [Depth API developer guide for Android NDK](/ar/develop/c/depth/developer-guide)\n- [ARCore SDK for Android NDK API reference](/ar/reference/c)"]]