My app crashes in the debug mode if I run this line of code:
[brightnessFilter forceProcessingAtSize:imgView2.sizeInPixels];
This is the whole code:
UIImage *inputImage = imgView.image;
sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
brightnessFilter = [[GPUImageBrightnessFilter alloc] init];
// sepiaFilter = [[GPUImageSobelEdgeDetectionFilter alloc] init];
GPUImageView *imgView2 = (GPUImageView *)self.view;
[brightnessFilter forceProcessingAtSize:imgView2.sizeInPixels];
[sourcePicture addTarget:brightnessFilter];
[brightnessFilter addTarget:imgView2];
[sourcePicture processImage];
This is the log:
2014-05-13 16:04:46.671 Picxxr[5341:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView sizeInPixels]: unrecognized selector sent to instance 0x109fbed60'
My imgView:
imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 64, 320, 320)];
[self.view addSubview:imgView];
The code you shared is probably inside the implementation file of one of your UIViewController
's which I'm sure has an associated .xib or lies somewhere inside a storyboard.
Now take that UIViewController
, select the root view (the white background of the view controller) and change its class from UIView
to GPUImageView
as shown here.