GPUImage
GPUImage copied to clipboard
Switching From GPUImageStillCamera to GPUImagePicture produces orientation issues
Been playing around with the latest GPUImage and came across and interesting problem. My test app starts immediately with a live camera via GPUImageStillCamera, I have a button to select a image from the photo library which then switches the source to GPUImagePicture. If the select photo is portrait (i.e. the source image was taken with the iPhone in portrait mode), the display is rotated incorrectly. However, it appears that if the source image is landscape it is fine. The results are somewhat inconsistent, but this seems to be the general case.
Here is the test App's single View Controller:
@implementation ViewController {
GPUImageStillCamera *stillCamera;
GPUImagePicture *picture;
GPUImageFilter *filter;
}
@synthesize outputView;
- (void)viewDidLoad
{
[super viewDidLoad];
stillCamera = [[GPUImageStillCamera alloc] init];
stillCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
filter = [[GPUImageGammaFilter alloc] init];
[stillCamera addTarget:filter];
[filter addTarget:self.outputView];
[stillCamera startCameraCapture];
}
- (void)viewDidUnload
{
[self setOutputView:nil];
[super viewDidUnload];
}
- (IBAction)selectPhotoFromLibrary:(id)sender {
UIImagePickerController *controller = [[UIImagePickerController alloc] init];
controller.editing = NO;
controller.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
controller.delegate = self;
[stillCamera pauseCameraCapture];
[self presentModalViewController:controller animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *original = [info objectForKey:UIImagePickerControllerOriginalImage];
picture = [[GPUImagePicture alloc] initWithImage:original];
[stillCamera removeAllTargets];
[picture addTarget:filter];
[picture processImage];
[self dismissModalViewControllerAnimated:YES];
}
Accidentally submitted twice. closing this one.