LBXScan icon indicating copy to clipboard operation
LBXScan copied to clipboard

通过AVCaptureDevice获取感光度失败,发现你系统中已经使用啦,产生冲突

Open yuzhongxingke opened this issue 6 years ago • 4 comments

`- (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产生的,你里面使用啦,外面就不能用啦,不然就会冲突 现在想实现通过光线明暗的情况自动打开闪光灯进行补光,这个你能加上这个功能吗?或者弄个开关是否自动打开闪光灯,谢谢啦!

yuzhongxingke avatar Jun 21 '18 07:06 yuzhongxingke

能否在在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]];`

这样我们自己监听广播来获取光感度,多谢啦!

yuzhongxingke avatar Jun 22 '18 03:06 yuzhongxingke

同需求,希望大神可以多加一个方法,把光线强弱值转出来,ths!

iOSRay avatar Aug 16 '18 08:08 iOSRay

下次更新的时候抛出接口出来,暂时可以fork一下,然后按自己的需求修改后,pod的时候选择自己的仓库地址就可以了,如 pod 'LBXScan',git:"https://github.com/xxx/LBXScan.git"

MxABC avatar Aug 16 '18 09:08 MxABC

同需求,希望可以提供光感值的block出来

wuzhecode avatar Aug 22 '19 03:08 wuzhecode