2012-08-25 55 views
1

我用下面的代碼來捕捉圖像:AVCaptureStillImageOutput缺漏的元

[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError *error) { 
    CFDictionaryRef exifAttachments = CMGetAttachment(imageSampleBuffer, kCGImagePropertyExifDictionary, NULL); 
    NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer]; 
    UIImage *image = [[UIImage alloc] initWithData:imageData]; 
    NSDictionary *metadata = (__bridge NSDictionary*)exifAttachments; 
    NSLog(@"%@",metadata"); 
}]; 

,這裏是記錄的輸出:

ApertureValue = "2.526068811667588"; 
BrightnessValue = "-0.5270684580355165"; 
ExposureMode = 0; 
ExposureProgram = 2; 
ExposureTime = "0.06666666666666667"; 
FNumber = "2.4"; 
Flash = 16; 
FocalLenIn35mmFilm = 35; 
FocalLength = "4.28"; 
ISOSpeedRatings =  (
    500 
); 
MeteringMode = 5; 
PixelXDimension = 3264; 
PixelYDimension = 2448; 
SceneType = 1; 
SensingMethod = 2; 
ShutterSpeedValue = "3.906905022631062"; 
SubjectArea =  (
    1631, 
    1223, 
    881, 
    881 
); 
WhiteBalance = 0; 

爲什麼我沒有得到相關的元數據的任何時間?我想知道圖像拍攝的時間。

+0

我是否需要自己添加「kCGImagePropertyExifDateTimeOriginal」值?似乎有點違反直覺... – jadengeller

回答

0

我確定將日期和時間添加到元數據後添加到相機膠捲(對開發人員部分沒有任何工作)。無需擔心信息丟失!