avfoundation - AVCapturePhotoOutput 颜色与预览层不同

标签 avfoundation avcapturephotosettings

捕获图像时,输出图像的颜色与我在预览图层上看到的颜色不同。出于某种原因,颜色略有变化。有没有人遇到过这个问题?我怎样才能解决这个问题?

当我从 didFinishProcessingPhotoSampleBuffer 获取图像时,绿色有点暗
enter image description here

最佳答案

阅读 AVCapturePhotoOutput 的官方文档我找到了这个:

The AVCapturePhotoOutput class implicitly supports wide-gamut color photography. If the source AVCaptureDevice object’s activeColorSpace value is P3_D65, the capture output produces photos with wide color information (unless your AVCapturePhotoSettings object specifies an output format that does not support wide color).



这也是 activeColorSpace :

By default, a capture session automatically enables wide-gamut capture for supported devices and capture workflows...



所以也许你的设备默认支持它,这就是为什么在输出中你会看到不同颜色的图像。尝试更改 activeColorSpace看看这是否有所作为。

关于avfoundation - AVCapturePhotoOutput 颜色与预览层不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46574282/

相关文章:

ios - AVFoundation 错误代码

ios - AVCapturePhotoOutput isFlashScene键值观察

ios - 使用 AVCapturePhotoOutput 使用闪光灯拍照时出现问题

ios - 为什么 AVPlayerItem 的 canPlayFastForward 方法返回 False?

ios - AVAssetWriterInput视频无法获取

ios - Swift:如何从使用 AVFoundation 拍摄的照片中删除 EXIF 数据?

ios - 我可以在 iphone 12 上获得 PHAsset/PHAsset is hdr video/dolby vision 吗?

ios - CapturePhoto 无法快速工作 3

swift - AUAudioUnit 和 AudioUnit 有什么区别