Ipad 从摄影机捕获的GPUImage报告意外大小
使用GPUImage相机,我将相机设置为这样Ipad 从摄影机捕获的GPUImage报告意外大小,ipad,uiinterfaceorientation,gpuimage,ios9,gpuimagestillcamera,Ipad,Uiinterfaceorientation,Gpuimage,Ios9,Gpuimagestillcamera,使用GPUImage相机,我将相机设置为这样 - (void)setupSessionWithImageView:(GPUImageView *)captureView { GPUImageStillCamera *stillCamera = [[GPUImageStillCamera alloc] init]; GPUImageGammaFilter *colorFilter = [[GPUImageGammaFilter alloc] init]; [stillCam
- (void)setupSessionWithImageView:(GPUImageView *)captureView
{
GPUImageStillCamera *stillCamera = [[GPUImageStillCamera alloc] init];
GPUImageGammaFilter *colorFilter = [[GPUImageGammaFilter alloc] init];
[stillCamera addTarget:colorFilter];
[colorFilter addTarget:captureView];
self.colorFilter = colorFilter;
self.stillCamera = stillCamera;
self.captureView = captureView;
[stillCamera startCameraCapture];
}
为了在视图控制器上调用viewwilltransitionosize:
时模拟苹果的iPad摄像头,我更新了静止摄像头上的outputImageOrientation
。这会旋转视频预览,以便在iPad方向改变时保持正确的方向
- (void)setOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationUnknown) { // default to portrait if we don't know
interfaceOrientation = UIInterfaceOrientationPortrait;
}
self.stillCamera.outputImageOrientation = interfaceOrientation;
}
我的问题是,当我使用iOS 9使用此设置拍摄照片时,所有横向图像都会报告其大小,就好像它们是纵向图像一样(因此短边表示宽度,长边表示高度),但它们报告的方向正确。没有表明对AVFoundation的任何更改听起来可能会影响这一点。将outputImageOrientation
保留为肖像解决了这一问题,但通过旋转视图,我无法在iPad上模仿苹果的原生相机功能
- (void)captureImage
{
GPUImageStillCamera *stillCamera = self.stillCamera;
[stillCamera capturePhotoAsImageProcessedUpToFilter:self.colorFilter withCompletionHandler:^(UIImage *processedImage, NSError *error) {
NSLog(@"image orientation %ld", (long)processedImage.imageOrientation);
NSLog(@"image size %f width x %f height", processedImage.size.width, processedImage.size.height);
}];
}
我的GPUImage实现和/或如何处理相机中的方向变化是否有问题?可以在上找到整个示例项目。在iOS 8中,在图像报告准确反映其方向属性的大小之前。Hi,您找到了解决方法吗?不幸的是,没有,我最终从相机上移除了方向支持:(我没有检查当前版本的GPUImage是否已解决。您好,您找到如何解决此问题的方法了吗?不幸的是,没有,我最终从相机上删除了方向支持:(我没有检查当前版本的GPUImage是否已解决。)。