次のコードを使用して画像をキャプチャします。
[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;
時間関連のメタデータを取得できないのはなぜですか? いつ撮影されたのか知りたいです。