ARCore Depth API が Geospatial Depth をサポートするようになりました。Streetscape Geometry も有効になっている場合は、Depth API の範囲と速度が自動的に向上します。場所が VPS でカバーされ、Streetscape Geometry が有効になっている場合、Depth API からの出力画像には、現在の位置から 65 m 以内のエリアから取得した地形や建物のジオメトリが含まれます。ジオメトリから取得したこの奥行きデータは、ローカルの深度観測データと結合され、ユーザーが新しい場所に移動すると更新されます。
ARCore Depth API 呼び出しにより、カメラからのローカル観測と、ストリートビュー ジオメトリからの建物と地形の両方が、単一の深度画像に統合されて提供されるようになりました。
デバイスの互換性
Geospatial Depth は、Depth API をサポートするすべてのデバイスで利用できます。この機能には、Time of Flight(ToF)センサーなど、サポートされているハードウェア深度センサーは必要ありません。ただし、Depth API は、デバイスでサポートされている任意のハードウェア センサーを利用します。
パフォーマンスへの影響
Geospatial Depth は、セッションの開始時に 1 回限りの小さな計算を行って、最初のダウンロード時に Streetscape Geometry を奥行きの表現に統合しますが、それ以外は奥行きの計算コストを大幅に増加させることはありません。
深さの範囲
Geospatial Depth を使用しない場合、深度画像の一般的な範囲は 20 ~ 30 m ほど離れており、その範囲を超えると、深度観測の密度と精度が低下します。Geospatial Depth を有効にすると、初期の移動が少なくても、密にサンプリングされた深度値が最大 65.535 m に達することが一般的です。
ユースケース
ARCore Depth API は、すでにサポートされているすべての既存のユースケースに使用できます。Geospatial Depth を使用すると、VPS に対応している場所で取得した奥行きの画像に、従来よりも速く長距離の深度が挿入されるため、屋外環境で長距離の奥行きをターゲットとするユースケースが可能になります。ユースケースには、次のようなものがあります。
- 仮想コンテンツとその他の視覚効果の建物スケール オクルージョン
- 屋外ナビ
- 距離の計測
制限事項
Geospatial Depth は、VPS のローカライズと Streetscape Geometry をサポートしているエリアでのみサポートされています。その他の領域では、ARCore Depth API は地理空間値なしで通常どおり動作します。
前提条件
続行する前に、AR の基本的なコンセプトと ARCore セッションを構成する方法を理解しておいてください。
Geospatial Depth を有効にする
新しい ARCore セッションで、ユーザーのデバイスが Depth と Geospatial API をサポートしているかどうかを確認します。処理能力の制約により、すべての ARCore 対応デバイスが Depth API をサポートしているわけではありません。
リソースを節約するため、ARCore では、深度がデフォルトで無効になっています。 アプリで Depth API を使用するには、深度モードを有効にします。 さらに、Geospatial Depth を使用するには、Geospatial モードと Streetscape Geometry を有効にします。
int32_t is_depth_supported = 0; int32_t is_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);
Geospatial Depth を有効にすると、奥行きに関するデベロッパー ガイドに記載されているように、既存の API 呼び出しを介して奥行き画像にアクセスできるようになります。
// 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; }
次のステップ
- 拡張現実で街並みのジオメトリを使用する方法を学びます。