自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
广色域拍摄
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
对于搭载 Android 14 或更高版本的设备,Android 支持 Display P3 广色域拍摄。设备可以使用 ImageReader
类拍摄 JPEG 格式的广色域色彩图片,而无需使用 10 位 HDR。借助此功能,设备可以通过 SessionConfiguration
中的 setColorSpace
参数请求向 Camera2 框架请求广色域空间中的相机拍摄。
要求
如需支持广色域拍摄,设备必须支持具有广色域色彩的相机。
实现
如需支持 Display P3 广色域拍摄请求,请执行以下操作:
- 读取
Stream.aidl
中的 colorSpace
字段并将其应用于输出流。
- 实现
android.request.availableColorSpaceProfilesMap
元数据条目。
- 在
android.request.availableCapabilities
中报告 COLOR_SPACE_PROFILES
功能。
如需查看支持 P3 广色域拍摄的相机 HAL 参考实现,请参阅 /hardware/google/camera/devices/EmulatedCamera/hwl/
configs/emu_camera_back.json
中的以下内容:
如需详细了解相机 HAL 中的广色域拍摄,请参阅 metadata_definitions.xml
中的以下值:
API
对于搭载 Android 14 或更高版本且支持广色域拍摄的设备,相机客户端可以使用以下公共 API:
ColorSpace
参数的预期值衍生自 ColorSpace.Named
类。Android 14 支持 SRGB
、DISPLAY_P3
和 BT2020_HLG
。
验证
如需验证 Display P3 广色域拍摄支持的实现情况,请运行以下测试。
CTS
android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#test8BitColorSpaceOutputCharacteristics
android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#test10BitColorSpaceOutputCharacteristics
android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#testColorSpaceProfileMap
android.hardware.camera2.cts.ImageReaderTest#testDisplayP3Jpeg
android.hardware.camera2.cts.ImageReaderTest#testDisplayP3JpegRepeating
android.hardware.camera2.cts.ImageReaderTest#testDisplayP3Heic
android.hardware.camera2.cts.ImageReaderTest#testDisplayP3HeicRepeating
ITS
运行相机图像测试套件 (ITS) 测试以验证以下内容:
- ICC 配置文件是否存在且色度坐标是否正确
- 图片是否包含 sRGB 色域之外的像素数据
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[null,null,["最后更新时间 (UTC):2025-03-26。"],[],[],null,["# Wide gamut capture\n\nFor devices running Android 14 or higher, Android\nprovides support for Display P3 wide gamut capture. Devices can capture wide\ngamut color images in JPEG format with the `ImageReader` class without\nusing [10-bit HDR](/docs/core/camera/10-bit-camera-output). This feature lets\ndevices\nrequest camera capture in a wide gamut color space to the Camera2 framework\nthrough the [`setColorSpace`](https://developer.android.com/reference/android/hardware/camera2/params/SessionConfiguration#setColorSpace(android.graphics.ColorSpace.Named)) parameter in `SessionConfiguration`.\n\nRequirements\n------------\n\nTo support wide gamut capture, the device must have access to a camera with wide\ngamut color capabilities.\n\nImplementation\n--------------\n\nTo support Display P3 wide gamut capture requests, do the following:\n\n- Read the `colorSpace` field in [`Stream.aidl`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/camera/device/aidl/android/hardware/camera/device/Stream.aidl) and apply it to the output stream.\n- Implement the `android.request.availableColorSpaceProfilesMap` metadata entry.\n- Report the `COLOR_SPACE_PROFILES` capability in `android.request.availableCapabilities`.\n\nFor a reference Camera HAL implementation supporting P3 wide gamut capture,\nsee the following in `/hardware/google/camera/devices/EmulatedCamera/hwl/\nconfigs/emu_camera_back.json`:\n\n- [`android.request.availableCapabilities`](https://android.googlesource.com/platform/hardware/google/camera/+/refs/heads/android16-release/devices/EmulatedCamera/hwl/configs/emu_camera_back.json#183)\n- [`android.request.availableColorSpaceProfilesMap`](https://android.googlesource.com/platform/hardware/google/camera/+/refs/heads/android16-release/devices/EmulatedCamera/hwl/configs/emu_camera_back.json#211)\n\nFor further details on wide gamut capture in the Camera HAL, see the following\nvalues in `metadata_definitions.xml`:\n\n- [`availableColorSpaceProfiles`](https://android.googlesource.com/platform/system/media/+/refs/heads/android16-release/camera/docs/metadata_definitions.xml#7163)\n- [`availableColorSpaceProfilesMap`](https://android.googlesource.com/platform/system/media/+/refs/heads/android16-release/camera/docs/metadata_definitions.xml#7184)\n- [`COLOR_SPACE_PROFILES`](https://android.googlesource.com/platform/system/media/+/refs/heads/android16-release/camera/docs/metadata_definitions.xml#6610)\n\n### APIs\n\nFor devices running Android 14 or higher with support\nfor wide gamut capture, camera clients can use the following public APIs:\n\n- [`ColorSpaceProfiles`](https://developer.android.com/reference/android/hardware/camera2/params/ColorSpaceProfiles)\n- [`setColorSpace`](https://developer.android.com/reference/android/hardware/camera2/params/SessionConfiguration#setColorSpace(android.graphics.ColorSpace.Named))\n\nThe expected values for the `ColorSpace` parameter are derived from the\n[`ColorSpace.Named`](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)\nclass. In Android 14, `SRGB`, `DISPLAY_P3`,\nand `BT2020_HLG` are supported.\n\nValidation\n----------\n\nTo validate your implementation of Display P3 wide gamut capture support, run\nthe following tests.\n\n### CTS\n\n- `android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#test8BitColorSpaceOutputCharacteristics`\n- `android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#test10BitColorSpaceOutputCharacteristics`\n- `android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#testColorSpaceProfileMap`\n- `android.hardware.camera2.cts.ImageReaderTest#testDisplayP3Jpeg`\n- `android.hardware.camera2.cts.ImageReaderTest#testDisplayP3JpegRepeating`\n- `android.hardware.camera2.cts.ImageReaderTest#testDisplayP3Heic`\n- `android.hardware.camera2.cts.ImageReaderTest#testDisplayP3HeicRepeating`\n\n### ITS\n\nRun the\n[Camera Image Test Suite (ITS)](/docs/compatibility/cts/camera-its)\ntests to validate the following:\n\n- Presence of an ICC profile with correct chromaticity coordinates\n- Image contains pixel data outside the sRGB gamut"]]