Created
November 9, 2016 05:58
-
-
Save Limon-O-O/683ffdec05ef9ffd60cbc9ef58d7d9df to your computer and use it in GitHub Desktop.
get brightness value from CMSampleBuffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getBrightnessValue(from sampleBuffer: CMSampleBuffer) -> Float { | |
guard | |
let metadataDict = CMCopyDictionaryOfAttachments(nil, sampleBuffer, kCMAttachmentMode_ShouldPropagate) as? [String: Any], | |
let exifMetadata = metadataDict[String(kCGImagePropertyExifDictionary)] as? [String: Any], | |
let brightnessValue = exifMetadata[String(kCGImagePropertyExifBrightnessValue)] as? Float | |
else { return 0.0 } | |
return brightnessValue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use CGFloat instead of Float