有没有办法获得相机的流的iOS上的亮度水平? [英] Is there a way to be get the brightness level on iOS of a stream of the camera?

查看:593
本文介绍了有没有办法获得相机的流的iOS上的亮度水平?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iPhone / iPad相机获取视频流并在视频流上进行识别,但是随着照明更改,它对鲁棒性有负面影响。我已经在不同的光测试不同的设置,可以得到它的工作,但尝试获取设置在运行时调整是我需要的。

I am using the iPhone/iPad camera to get a video stream and doing recognition on the stream, but with lighting changes it has a negative impact on the robustness. I have tested different settings in different light and can get it to work, but trying to get the settings to adjust at run time is what I need.

我可以计算简单的亮度检查每个帧,但相机调整和抛出我的结果。

I can calculate a simple brightness check on each frame, but the camera adjusts and throws my results off. I can watch for sharp changes and run checks then, but gradual changes would throw my results off as well.

理想情况下,我想要访问摄像机/ EXIF数据

Ideally I'd be like to access the camera/EXIF data for the stream and see what it is registering the unfiltered brightness as, is there a way to do this?

(我在iOS 5及更高版本的设备上工作)

(I am working for devices iOS 5 and above)

谢谢

推荐答案

可在iOS 4.0及以上版本中使用。可以从CMSampleBufferRef获取EXIF信息。

Available in iOS 4.0 and above. It's possible to get EXIF information from CMSampleBufferRef.

//Import ImageIO & include framework in your project. 
#import <ImageIO/CGImageProperties.h>

在你的示例缓冲区中,委托免费桥接将获得来自CoreMedia的CMGetAttachment的结果的NSDictionary。 p>

In your sample buffer delegate toll-free bridging will get a NSDictionary of results from CoreMedia's CMGetAttachment.

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
    NSDictionary* dict = (NSDictionary*)CMGetAttachment(sampleBuffer, kCGImagePropertyExifDictionary, NULL);

这篇关于有没有办法获得相机的流的iOS上的亮度水平?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆