Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Chống rung khi xem trước của máy ảnh
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Đối với các thiết bị chạy Android 13 trở lên, khung máy ảnh sẽ hỗ trợ tính năng ổn định video trên luồng xem trước và các luồng không phải RAW khác trong các phiên chụp ảnh bằng máy ảnh. Tính năng này cho phép các ứng dụng bên thứ ba cung cấp trải nghiệm như bạn thấy thì bạn sẽ nhận được (WYSIWYG) khi so sánh giữa bản xem trước của máy ảnh và bản ghi.
Triển khai
Để cung cấp tính năng này cho các ứng dụng bên thứ ba, nhà sản xuất thiết bị phải quảng cáo tính năng hỗ trợ cho các khoá sau và triển khai các thuật toán ổn định bản xem trước trong HAL máy ảnh:
Để sửa đổi chế độ cài đặt mặc định cho tính năng này, hãy chỉ định một giá trị mặc định trong mẫu yêu cầu chụp khi tạo yêu cầu chụp bằng createCaptureRequest
.
Để tham khảo cách triển khai tính năng này, hãy xem mã cho EmulatedCamera
trong Cuttlefish tại hardware/google/camera/devices/EmulatedCamera/hwl/EmulatedSensor.cpp
.
Để biết thêm thông tin chi tiết về các chế độ ổn định video, hãy xem CONTROL_VIDEO_STABILIZATION_MODE
.
Xác nhận kết quả
Để kiểm thử việc triển khai tính năng này, hãy sử dụng các kiểm thử CTS và ITS sau:
CTS:
ITS (kiểm thử trường nhìn và chất lượng ổn định):
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[],[],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)"]]