0

我正在开发一个我正在捕获实时视频的 iPhone 应用程序。

我已将 AVCaptureVideoPreviewLayer 添加到 self.view.layer 作为子层。[self.view.layer addSublayer: self.prevLayer];

在同一个 self.view 上,我添加了一个图像作为子视图。[self.view addSubView:image];

现在我想要的是从实时视频中捕获图像,但图像也应该像它在屏幕上看到的那样进入该图片。我试图拍摄屏幕截图,但它只捕获图像而不是实时视频图像。任何机构都可以帮我解决这个问题。提前致谢。

4

1 回答 1

1

嗨,这将对您有所帮助,因为它对我有用

- (void)didTakePicture:(UIImage *)picture
{
    UIImage *frm = self.overlayViewController.imgOverlay.image;
    NSLog(@"width %f height %f",picture.size.width,picture.size.height);
    UIGraphicsBeginImageContext(picture.size);
    [picture drawAtPoint:CGPointMake(0,0)];
    [frm drawInRect:CGRectMake(0, 0, picture.size.width, picture.size.height)];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSLog(@"view %@",viewImage.debugDescription);
    [self.capturedImages addObject:viewImage];
}
于 2012-04-12T08:32:40.797 回答