Apply filter to live camera on button???

2 replies [Last post]
losqut
User offline. Last seen 8 years 48 weeks ago. Offline
Joined: 05/30/2012
Posts:

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?

slevi
User offline. Last seen 8 years 48 weeks ago. Offline
Joined: 04/20/2012
Posts:

I would be interested in a solution for this as well. Anyone managed to achieve this?

losqut
User offline. Last seen 8 years 48 weeks ago. Offline
Joined: 05/30/2012
Posts:

I can't find any solution. Start/stop camera doesn't help.

Syndicate content