CameraConfig
は、
基となるカメラセンサー(以下を含む):
- カメラ ID
- 深度センサーを使用するかどうか(可能な場合)
- カメラの向き:
<ph type="x-smartling-placeholder">
- </ph>
- 前面(自撮り)
- 背面(全世界)
- FPS(フレーム/秒)範囲
- CPU イメージのサイズ
- GPU テクスチャのサイズ
- 存在する場合、デバイスのステレオ マルチカメラが使用されるかどうか
新しい ARCore セッションを作成する場合、ARCore は
カメラ設定を設定する setCameraConfig
使用可能な構成のリストに最も一致する
getSupportedCameraConfigs(CameraConfigFilter)
。
アプリで CameraConfigFilter
を使用できます。
実行時に特定のデバイスで利用可能なカメラ構成を絞り込むには、
アプリのニーズに応じてフィルタできます
フィルタリングの一般的な使用例は次のとおりです。
カメラのキャプチャ フレームレートを 30 fps に制限する。対応デバイス 60 fps の場合、ARCore はそれをサポートするカメラ構成を優先します。 あります。60 fps をサポートするすべてのカメラ構成を除外するには、次のようにします。
setTargetFps
でフィルタを適用するTargetFps.TARGET_FPS_30
を使用します。ARCore が深度センサーを使用できないようにします。 サポートされているため、ARCore は深度センサーを使用するカメラ構成を優先します。 センサー。奥行きセンサーを使用するすべてのカメラ設定を除外するには、
setDepthSensorUsage
DepthSensorUsage.DO_NOT_USE
を使用してフィルタします。// Return only camera configs that will not use the depth sensor.
filter.setDepthSensorUsage(EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE));// Return only camera configs that will not use the depth sensor.
filter.depthSensorUsage = EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE)代替の GPU テクスチャ解像度の選択。オン サポートされているデバイス、ARCore の GPU テクスチャの解像度が向上しています。低解像度の GPU テクスチャの選択 GPU の負荷を軽減しメモリを減らすことで、アプリのパフォーマンスを改善できる 要件がありますが、すべての環境でのパフォーマンスの向上は あります。
カメラ構成フィルタの使用
アプリがカメラ設定をフィルタできるようにする手順は次のとおりです。
// Create a camera config filter for the session.
CameraConfigFilter filter = new CameraConfigFilter(session);
// Return only camera configs that target 30 fps camera capture frame rate.
filter.setTargetFps(EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30));
// Return only camera configs that will not use the depth sensor.
filter.setDepthSensorUsage(EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE));
// Get list of configs that match filter settings.
// In this case, this list is guaranteed to contain at least one element,
// because both TargetFps.TARGET_FPS_30 and DepthSensorUsage.DO_NOT_USE
// are supported on all ARCore supported devices.
List<CameraConfig> cameraConfigList = session.getSupportedCameraConfigs(filter);
// Use element 0 from the list of returned camera configs. This is because
// it contains the camera config that best matches the specified filter
// settings.
session.setCameraConfig(cameraConfigList.get(0));
// Create a camera config filter for the session.
val filter = CameraConfigFilter(session)
// Return only camera configs that target 30 fps camera capture frame rate.
filter.targetFps = EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30)
// Return only camera configs that will not use the depth sensor.
filter.depthSensorUsage = EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE)
// Get list of configs that match filter settings.
// In this case, this list is guaranteed to contain at least one element,
// because both TargetFps.TARGET_FPS_30 and DepthSensorUsage.DO_NOT_USE
// are supported on all ARCore supported devices.
val cameraConfigList = session.getSupportedCameraConfigs(filter)
// Use element 0 from the list of returned camera configs. This is because
// it contains the camera config that best matches the specified filter
// settings.
session.cameraConfig = cameraConfigList[0]
フォーカス モード
セッション設定でフォーカス モードを設定することもできます。固定フォーカスは、一般的にトラッキングに適しています(ほとんどのデバイスで ARCore のデフォルトです)。 オート フォーカスは、録画、写真、動画の撮影や、近くの被写体にピントを合わせる必要がある場合に必要です。
Config.FocusMode
を参照してください。
をご覧ください。