ARCore Depth API 現在支援地理空間深度,如果同時啟用街景服務幾何圖形,就會自動增加深度 API 的範圍和速度。在 VPS 涵蓋範圍啟用街景服務幾何圖形的情況下,輸出圖像會納入 Depth API 的輸出圖像,包括從目前位置擷取到 65 公尺內區域的地形和建築物幾何圖形。從幾何圖形擷取的深度資料會與局部深度觀察合併,並會隨著使用者移動到新位置而更新。
ARCore Depth API 呼叫現在會合併為單一深度圖片,提供相機的當地觀測,以及街景服務幾何圖形的建築物和地形。
裝置相容性
地理空間深度適用於所有支援深度 API 的裝置。這項功能不必使用支援的硬體深度感應器,例如飛行時間 (ToF) 感應器。然而 Depth API 會使用裝置可能支援的任何硬體感應器。
int32_tis_depth_supported=0;int32_tis_geospatial_supported=0;// Check whether the user's device supports the Depth API.ArSession_isDepthModeSupported(ar_session,AR_DEPTH_MODE_AUTOMATIC,&is_depth_supported);ArSession_isGeospatialModeSupported(ar_session,AR_GEOSPATIAL_MODE_ENABLED,&is_geospatial_supported);ArConfig*ar_config=NULL;ArConfig_create(ar_session,&ar_config);if(is_depth_supported && is_geospatial_supported){// These three settings are needed to use Geospatial Depth.ArConfig_setDepthMode(ar_session,ar_config,AR_DEPTH_MODE_AUTOMATIC);ArConfig_setGeospatialMode(ar_session,ar_config,AR_GEOSPATIAL_MODE_ENABLED);ArConfig_setStreetscapeGeometryMode(ar_session,ar_config,AR_STREETSCAPE_GEOMETRY_MODE_ENABLED);}CHECK(ArSession_configure(ar_session,ar_config)==AR_SUCCESS);ArConfig_destroy(ar_config);
// Retrieve the depth image for the current frame, if available.ArImage*depth_image=NULL;// If a depth image is available, use it here.if(ArFrame_acquireDepthImage16Bits(ar_session,ar_frame,&depth_image)!=AR_SUCCESS){// No depth image received for this frame.// This normally means that depth data is not available yet.// Depth data will not be available if there are no tracked// feature points. This can happen when there is no motion, or when the// camera loses its ability to track objects in the surrounding// environment.return;}
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eARCore Depth API now leverages Streetscape Geometry to enhance depth perception, extending range and speed in VPS-covered areas.\u003c/p\u003e\n"],["\u003cp\u003eGeospatial Depth merges local depth observations with terrain and building data, providing a comprehensive depth image up to 65 meters.\u003c/p\u003e\n"],["\u003cp\u003eThis feature is available on all Depth API-supported devices and does not necessitate a hardware depth sensor.\u003c/p\u003e\n"],["\u003cp\u003eGeospatial Depth enables new use cases like building-scale occlusion, outdoor navigation, and distance measurements with enhanced accuracy and range.\u003c/p\u003e\n"],["\u003cp\u003eIt is automatically activated in areas with VPS and Streetscape Geometry enabled, otherwise, the Depth API functions as usual.\u003c/p\u003e\n"]]],["Geospatial Depth enhances the ARCore Depth API by merging local camera observations with building and terrain data from Streetscape Geometry. This increases depth range up to 65 meters in VPS-supported areas. To use it, users must enable Depth, Geospatial, and Streetscape Geometry modes in their ARCore session. This feature does not increase computation costs significantly and allows for building-scale occlusion, outdoor navigation, and distance measurements. In unsupported areas, the Depth API functions normally.\n"],null,["# Increase your range with Geospatial Depth\n\nThe ARCore Depth API now supports Geospatial Depth, which automatically increases the range and speed of the Depth API when [Streetscape Geometry](/ar/develop/c/geospatial/streetscape-geometry) is also enabled. When in a location with VPS coverage and with Streetscape Geometry enabled, the output images from the Depth API include terrain and building geometry retrieved in the area out to 65 meters from the current position. This depth data retrieved from geometry is merged with local depth observations and gets updated as the user moves to a new location.\n\n\nYour browser does not support the video tag.\n\nYour browser does not support the video tag.\n\nARCore Depth API calls now provide both local observations from the camera as well as buildings and terrain from Streetscape Geometry, merged into a single depth image.\n\nDevice compatibility\n--------------------\n\nGeospatial Depth is available on all [devices that support the Depth API](/ar/devices). **This feature does not require a supported hardware depth sensor, such as a time-of-flight (ToF) sensor.** However, the Depth API makes use of any supported hardware sensors that a device may have.\n\nPerformance impact\n------------------\n\nGeospatial Depth introduces a small one-time computation at the start of the session to integrate Streetscape Geometry into the depth representation when initially downloaded, but otherwise does not measurably increase depth computation cost.\n\nDepth range\n-----------\n\nWithout Geospatial Depth, typical ranges in depth images are around 20-30 meters away, with the density and accuracy of depth observations reduced beyond that range. With Geospatial Depth enabled, it is typical to see densely sampled depth values reach the maximum of 65.535 meters, even with a small amount of initial movement.\n\nYour browser does not support the video tag.\n\nUse cases\n---------\n\nThe ARCore Depth API can be used for all existing use-cases already supported. With Geospatial Depth, depth images obtained in VPS-supported locations will be populated with long-range depth faster than before, enabling use-cases targeting long-range depth in outdoor environments. Some use-cases include:\n\n- Building-scale occlusion of virtual content and other visual effects\n- Outdoor navigation\n- Distance measurements\n\nLimitations\n-----------\n\nGeospatial Depth is only supported in areas that support VPS localization and Streetscape Geometry. In other areas, the ARCore Depth API will perform as normal without Geospatial values.\n\nPrerequisites\n-------------\n\nMake sure that you understand [fundamental AR concepts](/ar/develop/fundamentals)\nand how to [configure an ARCore session](/ar/develop/c/session-config) before proceeding.\n\nEnable Geospatial Depth\n-----------------------\n\nIn [a new ARCore session](/ar/develop/c/session-config),\ncheck whether a user's device supports Depth and the Geospatial API.\nNot all ARCore-compatible devices support the Depth API due to processing power constraints.\n\nTo save resources, depth is disabled by default on ARCore.\nEnable depth mode to have your app use the Depth API.\nAdditionally, enable Geospatial mode and Streetscape Geometry to\nuse Geospatial Depth. \n\n```c\nint32_t is_depth_supported = 0;\nint32_t is_geospatial_supported = 0;\n\n// Check whether the user's device supports the Depth API.\nArSession_isDepthModeSupported(ar_session, AR_DEPTH_MODE_AUTOMATIC,\n &is_depth_supported);\nArSession_isGeospatialModeSupported(ar_session, AR_GEOSPATIAL_MODE_ENABLED,\n &is_geospatial_supported);\nArConfig* ar_config = NULL;\nArConfig_create(ar_session, &ar_config);\nif (is_depth_supported && is_geospatial_supported) {\n // These three settings are needed to use Geospatial Depth.\n ArConfig_setDepthMode(ar_session, ar_config, AR_DEPTH_MODE_AUTOMATIC);\n ArConfig_setGeospatialMode(ar_session, ar_config,\n AR_GEOSPATIAL_MODE_ENABLED);\n ArConfig_setStreetscapeGeometryMode(ar_session, ar_config,\n AR_STREETSCAPE_GEOMETRY_MODE_ENABLED);\n}\nCHECK(ArSession_configure(ar_session, ar_config) == AR_SUCCESS);\n\nArConfig_destroy(ar_config);\n```\n\nOnce Geospatial Depth is enabled, depth images can be accessed through existing API calls as described in the [depth developer guide](/ar/develop/c/depth/developer-guide). \n\n```c\n// Retrieve the depth image for the current frame, if available.\nArImage* depth_image = NULL;\n// If a depth image is available, use it here.\nif (ArFrame_acquireDepthImage16Bits(ar_session, ar_frame, &depth_image) !=\n AR_SUCCESS) {\n // No depth image received for this frame.\n // This normally means that depth data is not available yet.\n // Depth data will not be available if there are no tracked\n // feature points. This can happen when there is no motion, or when the\n // camera loses its ability to track objects in the surrounding\n // environment.\n return;\n}\n```\n\nWhat's next\n-----------\n\n- Learn how to use [Streetscape Geometry](/ar/develop/c/geospatial/streetscape-geometry) in your augmented reality experience."]]