昨日は、AVFoundationを使ってカメラ画面を起動する方法を書きました。
今日は、引き続き、AVFoundationを使ってカメラ撮影をするプログラムを書きたいと思います。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | AVCaptureConnection *stillImageConnection = [stillImageOutput connectionWithMediaType:AVMediaTypeVideo]; AVCaptureVideoOrientation avcaptureOrientation = AVCaptureVideoOrientationPortrait; [stillImageConnection setVideoOrientation:avcaptureOrientation]; [stillImageConnection setVideoScaleAndCropFactor:1]; [stillImageOutput setOutputSettings:[NSDictionary dictionaryWithObject:AVVideoCodecJPEG forKey:AVVideoCodecKey]]; [stillImageOutput captureStillImageAsynchronouslyFromConnection:stillImageConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) { if (error) { } NSData *jpegData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer]; } ]; |
前回のプログラムとあわせて利用すると便利かなと。
0 コメント:
コメントを投稿