iPhone - UIImagePickerController take screen shots?
I am trying to use the following code to take screen shots from my uiimagePickerController
UIGraphicsBeginImageContext(imagePicker.view.bounds.size);
[self.imagePicker.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
It shows everything except what is capturing from the camera, i see the cancel button, take photo buttom. Instead of what is displaying on the camera it's capturing a black screen, is there any way around this? or a better way to automatically capture an image from camera every 1 seconds?
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
{
UIImage *image = [self imageFromSampleBuffer:sampleBuffer];
UIImageView *img = [[UIImageView alloc] initWithImage:image];
[img setFrame:CGRectMake(0, 0, 320, 480)];
[self.view addSubview:img];
[img release];
}
开发者_开发百科
You want to use the new (in OS 4) AVFoundation APIs.
Try this page for some info:
http://developer.apple.com/iphone/library/qa/qa2010/qa1702.html
精彩评论