HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 即使使用闪光灯,AVCaptureOutput会拍摄暗色的图像大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经提出了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会拍摄暗色的图像所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。