自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
相機預覽防震功能
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
對於搭載 Android 13 以上版本的裝置,相機架構會在相機擷取工作階段中,支援預覽串流和其他非 RAW 串流的影片穩定功能。這項功能可讓第三方應用程式在比較相機預覽畫面和錄影畫面時,提供「所見即所得」 (WYSIWYG) 體驗。
實作
如要為第三方應用程式提供這項功能,裝置製造商必須宣傳支援下列鍵,並在相機 HAL 中實作預覽穩定化演算法:
如要修改這項功能的預設設定,請在使用 createCaptureRequest
建立擷取要求時,在擷取要求範本中指派預設值。
如需這項功能的參考實作項目,請參閱 hardware/google/camera/devices/EmulatedCamera/hwl/EmulatedSensor.cpp
中的 Cuttlefish EmulatedCamera
程式碼。
如要進一步瞭解影像穩定器模式,請參閱 CONTROL_VIDEO_STABILIZATION_MODE
。
驗證
如要測試您對這項功能的實作方式,請使用下列 CTS 和 ITS 測試:
CTS:
ITS (測試視野和穩定性品質):
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","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-07-26 (世界標準時間)。"],[],[],null,["# Camera preview stabilization\n\nFor devices running Android 13 or higher, the camera\nframework provides support for video stabilization on the preview stream\nand other non-RAW streams in camera capture sessions. This feature lets\nthird-party apps provide a *what you see is what you get* (WYSIWYG) experience\nwhen comparing between the camera preview and the recording.\n\nImplementation\n--------------\n\nTo provide third-party apps with this feature, device\nmanufacturers must advertise support for the following keys and implement\npreview stabilization algorithms in the camera HAL:\n\n- [`CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES`](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES)\n- [`CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION`](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION)\n\nTo modify the default settings for this feature, assign a default value in the\ncapture request template when creating a capture request using\n[`createCaptureRequest`](https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureRequest(int,%20java.util.Set%3Cjava.lang.String%3E)).\n\nFor a reference implementation of this feature, see the code for\n`EmulatedCamera` in [Cuttlefish](/docs/devices/cuttlefish) at\n[`hardware/google/camera/devices/EmulatedCamera/hwl/EmulatedSensor.cpp`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/google/camera/devices/EmulatedCamera/hwl/EmulatedSensor.cpp#823).\n\nFor more details on video stabilization modes, see\n[`CONTROL_VIDEO_STABILIZATION_MODE`](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE).\n\nValidation\n----------\n\nTo test your implementation of this feature, use the following CTS and ITS\ntests:\n\nCTS:\n\n- [`RobustnessTest.java#testMandatoryPreviewStabilizationOutputCombinations`](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java)\n\nITS (tests field of view and stabilization quality):\n\n- [`scene4/test_preview_Stabilization_fov.py`](/docs/compatibility/cts/camera-its-tests#test_preview_stabilization_fov)\n- [`sensor_fusion/test_preview_stabilization.py`](/docs/compatibility/cts/camera-its-tests#test_preview_stabilization)"]]