5

I am developping a feature which read the light data around the iPhone. The code part as below.

- (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];

    NSLog(@"%f",brightnessValue);
    self.lblLight.text = [NSString stringWithFormat:@"Brightness Value:%.2f", brightnessValue];
}

As log output, the value is a positive float number, like 5.212474 and negative float number When I coverred the camera.

Here is my question:

  1. What is the unit of the brightness value getting by kCGImagePropertyExifBrightnessValue?

  2. What's the range of the brightness value?

I have read the Apple development documentation EXIF Dictionary Keys, but the description is very simple and crude.

I checked the Exif data information, some answer point to APEX, but there is no range about it.

Anyone know this?

Thanks.

陈健 Mark
  • 341
  • 2
  • 14

0 Answers0