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.
Máy ảnh đơn sắc
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.
Các thiết bị chạy Android 9 trở lên có thể hỗ trợ máy ảnh đơn sắc. Android 10 hỗ trợ thêm định dạng luồng Y8, siêu dữ liệu tĩnh của mảng bộ lọc màu đơn sắc và gần hồng ngoại (NIR) cũng như các hàm DngCreator
cho máy ảnh đơn sắc.
Với khả năng này, nhà sản xuất thiết bị có thể triển khai thiết bị máy ảnh đơn sắc hoặc máy ảnh hồng ngoại gần (NIR) và giảm mức sử dụng bộ nhớ bằng cách sử dụng định dạng luồng Y8. Máy ảnh đơn sắc có thể đóng vai trò là máy ảnh thực tế cơ bản của một thiết bị nhiều máy ảnh logic để đạt được các đặc điểm nhiễu ánh sáng yếu tốt hơn.
Triển khai
Yêu cầu về phần cứng
Để triển khai tính năng này, thiết bị của bạn phải có cảm biến máy ảnh đơn sắc và bộ xử lý tín hiệu hình ảnh (ISP) để xử lý đầu ra của cảm biến.
Triển khai máy ảnh đơn sắc
Để quảng cáo thiết bị máy ảnh là máy ảnh đơn sắc, Camera HAL phải đáp ứng các yêu cầu sau:
android.sensor.info.colorFilterArray
được đặt thành MONO
hoặc NIR
.
- Các khoá bắt buộc
BACKWARD_COMPATIBLE
được hỗ trợ và MANUAL_POST_PROCESSING
không được hỗ trợ.
android.control.awbAvailableModes
chỉ chứa AUTO
và android.control.awbState
là CONVERTED
hoặc LOCKED
tuỳ thuộc vào android.control.awbLock
.
android.colorCorrection.mode
, android.colorCorrection.transform
và android.colorCorrection.gains
không có trong các khoá kết quả và yêu cầu hiện có. Do đó, thiết bị máy ảnh là LIMITED
.
Các khoá siêu dữ liệu tĩnh liên quan đến màu sau đây không có:
android.sensor.referenceIlluminant*
android.sensor.calibrationTransform*
android.sensor.colorTransform*
android.sensor.forwardMatrix*
android.sensor.neutralColorPoint
android.sensor.greenSplit
Tất cả kênh màu đều có cùng giá trị cho các khoá siêu dữ liệu sau:
android.sensor.blackLevelPattern
android.sensor.dynamicBlackLevel
android.statistics.lensShadingMap
android.tonemap.curve
android.sensor.noiseProfile
chỉ có một kênh màu.
Đối với các thiết bị đơn sắc hỗ trợ định dạng luồng Y8, HAL máy ảnh phải hỗ trợ việc hoán đổi định dạng YUV_420_888
trong các tổ hợp luồng bắt buộc (bao gồm cả việc xử lý lại) với định dạng Y8.
Các API công khai sau đây được dùng trong tính năng này:
Để biết thêm thông tin chi tiết về HAL máy ảnh, hãy xem docs.html.
Để biết thêm thông tin về các API công khai có liên quan, hãy xem ImageFormat, CameraCharacteristics, CaptureRequest và CaptureResult.
Xác nhận kết quả
Để xác thực việc triển khai máy ảnh đơn sắc, hãy chạy các kiểm thử CTS và VTS sau.
Kiểm thử CTS
testMonochromeCharacteristics
CaptureRequestTest
CaptureResultTest
StillCaptureTest
DngCreatorTest
Kiểm thử VTS
getCameraCharacteristics
processMultiCaptureRequestPreview
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,["# Monochrome cameras\n\nDevices running Android 9 or higher can support\nmonochrome cameras. Android 10\nprovides additional support for the Y8 stream format, monochrome and\nnear-infrared (NIR) color filter array\nstatic metadata, and `DngCreator` functions for monochrome cameras.\n\nWith this capability, device manufacturers can implement a monochrome or\nNIR camera device and reduce memory use by using\nthe Y8 stream format. A monochrome camera can serve as the underlying physical\ncamera of a\n[logical multi-camera device](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA)\nto achieve better low-light noise characteristics.\n\nImplementation\n--------------\n\n### Hardware requirements\n\nTo implement this feature, your device must have a monochrome camera sensor and\nan image signal processor (ISP) to process the sensor output.\n\n### Implement a monochrome camera\n\nTo advertise a camera device as a monochrome camera, the\n[Camera HAL](/docs/core/camera/camera3) must meet\nthe following requirements:\n\n- `android.sensor.info.colorFilterArray` is set to `MONO` or `NIR`.\n- `BACKWARD_COMPATIBLE` required keys are supported and `MANUAL_POST_PROCESSING` isn't supported.\n- `android.control.awbAvailableModes` only contains `AUTO` and `android.control.awbState` is either `CONVERTED` or `LOCKED` depending on `android.control.awbLock`.\n- `android.colorCorrection.mode`, `android.colorCorrection.transform`, and `android.colorCorrection.gains` aren't in available request and result keys. As a result, the camera device is [`LIMITED`](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata.html#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED).\n- The following color-related static metadata keys aren't present:\n\n - `android.sensor.referenceIlluminant*`\n - `android.sensor.calibrationTransform*`\n - `android.sensor.colorTransform*`\n - `android.sensor.forwardMatrix*`\n - `android.sensor.neutralColorPoint`\n - `android.sensor.greenSplit`\n- All color channels have the same values for the following metadata keys:\n\n - `android.sensor.blackLevelPattern`\n - `android.sensor.dynamicBlackLevel`\n - `android.statistics.lensShadingMap`\n - `android.tonemap.curve`\n- `android.sensor.noiseProfile` has only one color channel.\n\nFor monochrome devices supporting Y8 stream formats, the Camera HAL must support\nswapping `YUV_420_888` formats in mandatory stream combinations (including\nreprocessing) with Y8 formats.\n\nThe following public APIs are used in this feature:\n\n- [Y8 image format](https://developer.android.com/reference/android/graphics/ImageFormat#Y8)\n- [SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO)\n- [SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR)\n- [MONOCHROME camera capability](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME) (introduced in Android 9)\n\nFor more details on the Camera HAL, see\n[docs.html](https://android.googlesource.com/platform/system/media/+/android16-release/camera/docs/docs.html).\nFor more information on related public APIs, see\n[ImageFormat](https://developer.android.com/reference/android/graphics/ImageFormat),\n[CameraCharacteristics](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics),\n[CaptureRequest](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest),\nand\n[CaptureResult](https://developer.android.com/reference/android/hardware/camera2/CaptureResult).\n\nValidation\n----------\n\nTo validate your implementation of a monochrome camera, run the following CTS\nand VTS tests.\n\n### CTS tests\n\n- `testMonochromeCharacteristics`\n- `CaptureRequestTest`\n- `CaptureResultTest`\n- `StillCaptureTest`\n- `DngCreatorTest`\n\n### VTS tests\n\n- `getCameraCharacteristics`\n- `processMultiCaptureRequestPreview`"]]