0

我正在使用本教程使用 AVFoundation 捕获图像。我正在尝试将捕获的图像从 CaptureSessionManager(一个 NSObject 类)返回到 AROverlayViewController。我该怎么做呢?

我尝试放入@property (nonatomic, retain) UIImage *finalImage;AROverlayViewController.h,然后在 CaptureSessionManager.m 中进行设置arController.finalImage = image;,但日志显示 finalImage 为null.

关于如何最好地做到这一点的任何想法?谢谢!

4

3 回答 3

2

CaptureManager类上有一个属性

@property (nonatomic, retain) UIImage *stillImage;

您可以通过此代码获得

UIImage *final = [captureManager stillImage];
于 2012-08-23T06:20:48.767 回答
0

我终于明白了 - 添加UIImage *test = [captureManager stillImage];AROverlayViewController.m。上帝,这让我永远。

于 2012-08-23T06:17:06.670 回答
0
NSData *imageData;

- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
        [self performSelectorInBackground:@selector(showLoading) withObject:nil];

        UIImage *capturedImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
       imageData = [[NSData alloc]init]; 
       imageData = UIImagePNGRepresentation(capturedImage);
       [imageData retain];

       [reader dismissModalViewControllerAnimated: YES];

}

您可以将此 NSData 传递给您可以访问此图像的其他视图。

于 2012-08-23T06:17:59.963 回答