LBXScan
LBXScan copied to clipboard
通过AVCaptureDevice获取感光度失败,发现你系统中已经使用啦,产生冲突
`- (AVCaptureVideoDataOutput *)output { if (!_output) { _output = [[AVCaptureVideoDataOutput alloc] init]; [_output setVideoSettings:@{ (NSString *)kCVPixelBufferPixelFormatTypeKey : [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA] }]; [_output setAlwaysDiscardsLateVideoFrames:YES]; [_output setSampleBufferDelegate:self queue:_captureQueue];
[self.session addOutput:_output];
}
return _output; }`
光感度就是通过这个delegate产生的,你里面使用啦,外面就不能用啦,不然就会冲突 现在想实现通过光线明暗的情况自动打开闪光灯进行补光,这个你能加上这个功能吗?或者弄个开关是否自动打开闪光灯,谢谢啦!
能否在在LBXZXCapture.m的
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection 方法中,添加如下代码: `CFDictionaryRef metadataDict = CMCopyDictionaryOfAttachments(NULL,sampleBuffer, kCMAttachmentMode_ShouldPropagate); NSDictionary metadata = [[NSMutableDictionary alloc] initWithDictionary:(__bridge NSDictionary)metadataDict]; CFRelease(metadataDict); NSDictionary *exifMetadata = [[metadata objectForKey:(NSString *)kCGImagePropertyExifDictionary] mutableCopy]; float brightnessValue = [[exifMetadata objectForKey:(NSString *)kCGImagePropertyExifBrightnessValue] floatValue];
[[NSNotificationCenter defaultCenter] postNotificationName:@"brightnessValue" object:[NSString stringWithFormat:@"%f",brightnessValue]];`
这样我们自己监听广播来获取光感度,多谢啦!
同需求,希望大神可以多加一个方法,把光线强弱值转出来,ths!
下次更新的时候抛出接口出来,暂时可以fork一下,然后按自己的需求修改后,pod的时候选择自己的仓库地址就可以了,如 pod 'LBXScan',git:"https://github.com/xxx/LBXScan.git"
同需求,希望可以提供光感值的block出来