Apply filter to live camera on button???
Wed, 06/06/2012 - 04:04
Hello,
I am trying to apply filter to live camera on pressing button.
IBOutlet UIView *camImageView;
GPUImageVideoCamera *videoCamera;
if (button.selected == NO) { button.selected = YES; [videoCamera removeTarget:(GPUImageView *)self.camImageView]; if (filter == nil) filter = [[GPUImageSepiaFilter alloc] init]; [filter addTarget:(GPUImageView *)self.camImageView]; [videoCamera addTarget:filter]; videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait; } else { button.selected = NO; [filter removeTarget:(GPUImageView *)self.camImageView]; [videoCamera removeTarget:filter]; [videoCamera addTarget:(GPUImageView *)self.camImageView]; videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait; }
Filter GPUImageSepiaFilter applied but camera rotates to landscape position and videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait; doesn't help.
And sometimes after pressing button, it is showing black screen.
It it possible to apply filter by pressing button or I should start/stop camera?
I would be interested in a solution for this as well. Anyone managed to achieve this?