A partire dal 27 marzo 2025, ti consigliamo di utilizzare android-latest-release
anziché aosp-main
per compilare e contribuire ad AOSP. Per ulteriori informazioni, vedi Modifiche ad AOSP.
Bokeh della fotocamera
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Il bokeh della fotocamera è un effetto di profondità di campo ridotta creato sfocando parti di una scena in modo che non siano a fuoco. Sulle fotocamere dei dispositivi mobili, il bokeh viene ottenuto utilizzando le informazioni sulla profondità acquisite dalla visione stereo di due fotocamere o da doppi fotodiodi (PD) di una singola fotocamera.
A partire da Android 11, la piattaforma Android supporta le implementazioni di bokeh e fornisce API per rendere disponibile la funzionalità alle app di terze parti.
Implementazione
Per rendere disponibile la funzionalità Bokeh della fotocamera sul tuo dispositivo:
Fai pubblicità su ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES
:
Questo tag è nel formato di un array di tuple di tre interi, con ogni tuple
nel formato di {mode, maxWidth, maxHeight}
. Oltre a {ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED, 0, 0}
, l'HAL della videocamera deve elencare anche una o entrambe le modalità ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE
e ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS
con le relative dimensioni massime dello streaming.
Fai pubblicità
ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES
:
Questo tag ha il formato di un array {minZoomRatio, maxZoomRatio}
,
che contiene tutti gli intervalli di rapporti di zoom per una modalità di scena
estesa abilitata, nello stesso ordine di
ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES
. Un intervallo di zoom di[1.0, 1.0]
indica che lo zoom non è supportato.
Compila ANDROID_CONTROL_USE_EXTENDED_SCENE_MODE
in
ANDROID_CONTROL_AVAILABLE_MODES
.
Affinché un'app attivi la funzionalità Bokeh, deve impostare ANDROID_CONTROL_MODE
su ANDROID_CONTROL_USE_EXTENDED_SCENE_MODE
e ANDROID_CONTROL_EXTENDED_SCENE_MODE
su una delle modalità di scena estese supportate.
Tieni presente che l'implementazione del bokeh potrebbe comportare un maggiore consumo di memoria a causa del calcolo stereo.
Se una modalità scena estesa supportata non può essere applicata per frame e causa ritardi imprevisti quando viene attivata/disattivata, includi ANDROID_CONTROL_EXTENDED_SCENE_MODE
in ANDROID_REQUEST_AVAILABLE_SESSION_KEYS
. Allo stesso tempo, implementa il metodo
ICameraDeviceSession::isReconfigurationRequired()
per evitare la ricofigurazione per le modalità di scena estese che non richiedono la ricofigurazione.
Convalida
Per convalidare la funzionalità Bokeh sul tuo dispositivo, esegui i seguenti test CTS, VTS e CTS Verifier:
CtsCameraTestCases
VtsHalCameraProviderV2_4TargetTest
CameraBokehTest
nello strumento di verifica CTS
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-07-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"]]