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 を有効にします。
Java
Config config = session.getConfig(); // Check whether the user's device supports the Depth API. boolean isDepthSupported = session.isDepthModeSupported(Config.DepthMode.AUTOMATIC); boolean isGeospatialSupported = session.isGeospatialModeSupported(Config.GeospatialMode.ENABLED); if (isDepthSupported && isGeospatialSupported) { // These three settings are needed to use Geospatial Depth. config.setDepthMode(Config.DepthMode.AUTOMATIC); config.setGeospatialMode(Config.GeospatialMode.ENABLED); config.setStreetscapeGeometryMode(Config.StreetscapeGeometryMode.ENABLED); } session.configure(config);
Kotlin
val config = session.config // Check whether the user's device supports the Depth API. val isDepthSupported = session.isDepthModeSupported(Config.DepthMode.AUTOMATIC) val isGeospatialSupported = session.isGeospatialModeSupported(Config.GeospatialMode.ENABLED) if (isDepthSupported && isGeospatialSupported) { // These three settings are needed to use Geospatial Depth. config.depthMode = Config.DepthMode.AUTOMATIC config.geospatialMode = Config.GeospatialMode.ENABLED config.streetscapeGeometryMode = Config.StreetscapeGeometryMode.ENABLED } session.configure(config)
Geospatial Depth を有効にすると、奥行きに関するデベロッパー ガイドに記載されているように、既存の API 呼び出しを介して奥行き画像にアクセスできるようになります。
Java
// Retrieve the depth image for the current frame, if available. Image depthImage = null; try { depthImage = frame.acquireDepthImage16Bits(); // Use the depth image here. } catch (NotYetAvailableException e) { // This 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. } finally { if (depthImage != null) { depthImage.close(); } }
Kotlin
// Retrieve the depth image for the current frame, if available. try { frame.acquireDepthImage16Bits().use { depthImage -> // Use the depth image here. } } catch (e: NotYetAvailableException) { // This 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. }
次のステップ
- 拡張現実で街並みのジオメトリを使用する方法を学びます。
- Scene Semantics と Geospatial Depth Codelab を参照して、Geospatial Depth を使って独自のアプリを作成する方法を学習する。