Ios GPUImageStillCamera输出分辨率有限

Ios GPUImageStillCamera输出分辨率有限,ios,ipad,gpuimage,Ios,Ipad,Gpuimage,在配备iOS 6.1的iPad 3 Retina上,我使用以下功能初始化我的静态相机: stillCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPresetPhoto cameraPosition:AVCaptureDevicePositionBack]; stillCamera.outputImageOrientation = UIInterfaceOrientationLandscape

在配备iOS 6.1的iPad 3 Retina上,我使用以下功能初始化我的静态相机:

stillCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPresetPhoto cameraPosition:AVCaptureDevicePositionBack];
stillCamera.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;
我使用以下过滤器设置相机:

UIImage *inputImage = [UIImage imageNamed:@"blank-1x1.png"];
sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
[sourcePicture processImage];

chromaKeyBlendFilter = [[GPUImageChromaKeyBlendFilter alloc] init];
[chromaKeyBlendFilter setColorToReplaceRed:0.0 green:1.0 blue:0.0];
[chromaKeyBlendFilter setThresholdSensitivity:0.37f];
filter = chromaKeyBlendFilter;

[stillCamera addTarget:filter];
[sourcePicture addTarget:filter];

[filter addTarget:videoPreviewView]; // 1024x768 view
[stillCamera startCameraCapture];
当我拍摄图像时,我使用:

[stillCamera capturePhotoAsPNGProcessedUpToFilter:filter withCompletionHandler:^(NSData *processedPNG, NSError *error){
    self.currentImage = [UIImage imageWithData:processedPNG];
});
但我得到的图像是屏幕大小(视网膜样式)2048x1536,而不是我所期望的2420x1936。我还注意到,“imageFromCurrentlyProcessedOutputWithOrientation”也只返回屏幕大小,并且查看GPUImageStillCamera.m中的捕获代码,看起来这就是输出的来源

我不知道为什么,因为我还有一个选项/按钮来使用非GPUImage设置,我得到了2420x1936的PNG图像


我做错了什么?谢谢你的建议(因为我真的想要2420x1936)。

首先,我指的是2592x1936,用于iPad后置摄像头的全分辨率(我将图像裁剪为8x10大小)。事实证明,我试图变得太“聪明”

当我点击一个按钮来捕获图像时,我在后台线程中使用以下命令来获取图像,该图像在异步捕获时保存到属性中(在本例中,PNG文件的大小高达8mb)

但是,在调度了那个队列之后,我立即切换到一个预览视图,在那里我使用

[filter imageFromCurrentlyProcessedOutputWithOrientation:UIImageOrientationUp]
这是2048x1516,足以在iPad视网膜上显示预览。然后当预览被取消时,self.currentImage被裁剪并保存到一个文件(以及核心数据元数据)

我太“聪明”了,当我注意到预览显示时,我仍然从相机上收到记录的KVO控制台消息。所以,在VIEWWILLENGINE中,我加入了一个“暂停摄像头”,然后重新出现“恢复摄像头”。显然,当发出pause camera命令时,它会立即停止处理并将其内容转储到我的currentImage属性中,如果预览可以再等待几秒钟,则该属性始终是2048x1516图像,而不是完整的分辨率图像

IMHO,当相机暂停时,任何背景捕捉线程都应该继续,直到完成,然后暂停相机。但我可以解决这个问题,我很高兴我发现了这个问题

[filter imageFromCurrentlyProcessedOutputWithOrientation:UIImageOrientationUp]