自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
单色相机
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
搭载 Android 9 或更高版本的设备可以支持单色相机。Android 10 为 Y8 流格式、单色和近红外 (NIR) 色彩滤波阵列静态元数据提供了额外的支持,并为单色摄像头提供了 DngCreator
函数。
借助此功能,设备制造商可以实现单色或近红外线摄像头设备,并通过使用 Y8 流格式减少内存使用量。单色摄像头可以用作逻辑多摄像头设备的底层物理摄像头以获取更出色的低光噪音特性。
实现
硬件要求
要实现此功能,您的设备必须拥有单色摄像头传感器和图像信号处理器 (ISP) 以处理传感器输出。
实现单色相机
如需将相机设备播发为单色相机,相机 HAL 必须满足以下要求:
对于支持 Y8 流格式的单色设备,相机 HAL 必须支持将强制性信息流组合中的 YUV_420_888
格式替换(包括重新处理)为 Y8 格式。
该功能中会使用以下公共 API:
如需详细了解摄像头 HAL,请参阅 docs.html。如需详细了解相关公共 API,请参阅 ImageFormat、CameraCharacteristics、CaptureRequest 和 CaptureResult。
验证
要验证单色摄像头的实现情况,请运行以下 CTS 和 VTS 测试。
CTS 测试
testMonochromeCharacteristics
CaptureRequestTest
CaptureResultTest
StillCaptureTest
DngCreatorTest
VTS 测试
getCameraCharacteristics
processMultiCaptureRequestPreview
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[null,null,["最后更新时间 (UTC):2025-03-26。"],[],[],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`"]]