Skip to content

Instantly share code, notes, and snippets.

@hirokim
Created December 24, 2014 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirokim/07673a908adaeec88c7a to your computer and use it in GitHub Desktop.
Save hirokim/07673a908adaeec88c7a to your computer and use it in GitHub Desktop.
ブラケット撮影
NSArray *settings = @[
[AVCaptureManualExposureBracketedStillImageSettings manualExposureSettingsWithExposureDuration:CMTimeMake(1, 100) ISO:100.0],
[AVCaptureManualExposureBracketedStillImageSettings manualExposureSettingsWithExposureDuration:CMTimeMake(1, 200) ISO:400.0],
[AVCaptureManualExposureBracketedStillImageSettings manualExposureSettingsWithExposureDuration:CMTimeMake(1, 300) ISO:800.0]
];
[self.stillImageOutput
captureStillImageBracketAsynchronouslyFromConnection:videoConnection
withSettingsArray:settings
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, AVCaptureBracketedStillImageSettings *stillImageSettings, NSError *error) {
if (imageDataSampleBuffer == NULL) {
return;
}
// 入力された画像データからJPEGフォーマットとしてデータを取得
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
// JPEGデータからUIImageを作成
UIImage *image = [[UIImage alloc] initWithData:imageData];
// アルバムに画像を保存
UIImageWriteToSavedPhotosAlbum(image, self, nil, nil);
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment