ios – 即使使用闪光灯,AVCaptureOutput会拍摄暗色的图像

ios – 即使使用闪光灯,AVCaptureOutput会拍摄暗色的图像,第1张

概述我已经提出了AVFoundation和 ImageIO的实现来照顾我的应用程序中的照片.但是我有一个问题.我拍摄图像总是黑暗,即使闪光灯熄灭.这是我使用的代码: [[self currentCaptureOutput] captureStillImageAsynchronouslyFromConnection:[[self currentCaptureOutput].connections la 我已经提出了AVFoundation和 ImageIO的实现来照顾我的应用程序中的照片.但是我有一个问题.我拍摄的图像总是黑暗,即使闪光灯熄灭.这是我使用的代码:
[[self currentCaptureOutput] captureStillimageAsynchronouslyFromConnection:[[self currentCaptureOutput].connections lastObject]                                        completionHandler:^(CMSampleBufferRef imageDataSampleBuffer,NSError *error) {                                            [[[blockSelf currentPrevIEwLayer] session] stopRunning];                                            if (!error) {                                                NSData *data            = [AVCaptureStillimageOutput jpegStillimageNSDataRepresentation:imageDataSampleBuffer];                                                CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef) data,NulL);                                                if (source) {                                                    UIImage *image = [blockSelf imageWithSource:source];                                                    [blockSelf updateWithCapturedImage:image];                                                    CFRelease(source);                                                }                                            }                                        }];

有什么可能导致图像不包括闪光灯吗?

解决方法 如果AVCaptureSession在此呼叫之前立即设置,我发现我有时会看到较暗的图像.也许需要一段时间的自动曝光和白平衡设置调整自己.

解决方案是设置AVCaptureSession,然后在调用之前等待AVCaptureDevice的adjustExposure和adjustWhiteBalance属性都为NO(在KVO中观察这些属性) – [AVCaptureStillimageOutput captureStillimageAsynchronouslyFromConnection:completionHandler:].

总结

以上是内存溢出为你收集整理的ios – 即使使用闪光灯,AVCaptureOutput会拍摄暗色的图像全部内容,希望文章能够帮你解决ios – 即使使用闪光灯,AVCaptureOutput会拍摄暗色的图像所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1095537.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存