Created
December 24, 2014 06:31
-
-
Save hirokim/07673a908adaeec88c7a to your computer and use it in GitHub Desktop.
ブラケット撮影
This file contains 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
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