2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
カメラのボケ表現
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
カメラのボケ表現は、被写界深度を浅くし、シーンの一部をぼかしてフォーカスされないようにする効果です。モバイル デバイスのカメラでは、2 つのカメラまたは 1 つのカメラのデュアル フォトダイオード(PD)のステレオ ビジョンから取得した奥行きの情報を使用してボケ表現を実現します。
Android プラットフォームでは、Android 11 以降でボケ表現の実装をサポートしており、サードパーティ アプリでこの機能を使用するための API が提供されています。
実装
デバイスでカメラのボケ表現機能を使用できるようにするための手順は次のとおりです。
ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES
をアドバタイズする。
このタグでは、3 つの整数のタプル配列の形式が使用されており、各タプルでは {mode, maxWidth, maxHeight}
の形式が使用されています。{ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED, 0, 0}
に加えて、カメラ HAL では ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE
モードと ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS
モードのいずれかまたは両方を、対応する最大ストリーミング サイズとともにリストする必要もあります。
ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES
をアドバタイズする。
このタグでは、{minZoomRatio, maxZoomRatio}
の配列の形式が使用されており、有効な拡張シーンモードのすべてのズーム倍率範囲が ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES
と同じ順序で指定されます。ズーム範囲が [1.0, 1.0]
である、ズームがサポートされていないことを意味します。
ANDROID_CONTROL_AVAILABLE_MODES
に ANDROID_CONTROL_USE_EXTENDED_SCENE_MODE
を入力する。
アプリでボケ表現機能をトリガーするには、そのアプリで ANDROID_CONTROL_MODE
が ANDROID_CONTROL_USE_EXTENDED_SCENE_MODE
に設定され、ANDROID_CONTROL_EXTENDED_SCENE_MODE
がサポートされている拡張シーンモードのいずれかに設定されている必要があります。ボケ表現を実装すると、ステレオ計算によりメモリ消費量が増大する可能性があります。
サポートされている拡張シーンモードがフレームごとに適用されず、有効または無効にする際に予期しない遅延が発生する場合は、ANDROID_CONTROL_EXTENDED_SCENE_MODE
を ANDROID_REQUEST_AVAILABLE_SESSION_KEYS
に含めます。同時に、ICameraDeviceSession::isReconfigurationRequired()
メソッドを実装して、再構成を必要としない拡張シーンモードの再構成を回避します。
検証
デバイスでボケ表現機能を検証するには、次の CTS、VTS、CTS 検証ツールのテストを実行します。
CtsCameraTestCases
VtsHalCameraProviderV2_4TargetTest
- CTS 検証ツールの
CameraBokehTest
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-26 UTC。"],[],[],null,["# Camera bokeh is a shallow depth-of-field effect created by blurring out parts of\na scene so that they're not in focus. On cameras on mobile devices, bokeh is\nachieved using depth information acquired from the stereo vision from two\ncameras or from dual photodiodes (PDs) of a single camera.\n\nStarting from Android 11, the Android platform\nsupports bokeh implementations and provides APIs to make the feature available\nto third-party apps.\n\nImplementation\n--------------\n\nTo make the camera bokeh feature available on your device, do the following:\n\n- Advertise `ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES`:\n\n This tag is in the format of a three-integer tuple array, with each tuple\n in the format of `{mode, maxWidth, maxHeight}`. In addition to\n `{ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED, 0, 0}`, the camera HAL must\n also list one or both of the\n `ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE` and\n `ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS` modes with their\n corresponding maximum streaming sizes.\n- Advertise\n `ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES`:\n\n This tag is in the format of a `{minZoomRatio, maxZoomRatio}` array,\n which contains all the zoom ratio ranges for an enabled extended scene\n mode, in the same order as in\n `ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES`. A zoom range of\n `[1.0, 1.0]` means that zoom isn't supported.\n- Populate `ANDROID_CONTROL_USE_EXTENDED_SCENE_MODE` in\n `ANDROID_CONTROL_AVAILABLE_MODES`.\n\nFor an app to trigger the bokeh feature, the app must set `ANDROID_CONTROL_MODE`\nto `ANDROID_CONTROL_USE_EXTENDED_SCENE_MODE` and\n`ANDROID_CONTROL_EXTENDED_SCENE_MODE` to one of supported extended scene modes.\nNote that implementing bokeh might lead to extra memory consumption because of\nstereo computation.\n\nIf a supported extended scene mode can't be applied per frame and results in\nunexpected delays when enabled/disabled, include\n`ANDROID_CONTROL_EXTENDED_SCENE_MODE` in\n`ANDROID_REQUEST_AVAILABLE_SESSION_KEYS`. At the same time, implement the\n`ICameraDeviceSession::isReconfigurationRequired()` method to avoid\nreconfiguration for extended scene modes that don't require reconfiguration.\n\nValidation\n----------\n\nTo validate the bokeh feature on your device, run the following CTS, VTS, and\nCTS Verifier tests:\n\n- `CtsCameraTestCases`\n- `VtsHalCameraProviderV2_4TargetTest`\n- `CameraBokehTest` in CTS Verifier"]]