Reputation: 50
I have been working on this all day and am unable to find where my error is. This is my first experience using GPUImage. I am following the comments on the issues in GitHub as well as questions I have found here with no luck.
My GPUImageFilterGroup is returning a black image, but the filters in the group that I am using individually work on their own. I am simply trying to edit saturation and levels on a still image.
GPUImageFilterGroup* blackAndWhiteGroup = [[GPUImageFilterGroup alloc] init];
GPUImageSaturationFilter *satuaration = [[GPUImageSaturationFilter alloc] init];
[satuaration setSaturation:0.0];
GPUImageLevelsFilter *levels = [[GPUImageLevelsFilter alloc] init];
[levels setMin:56.0/255.0 gamma:1.15 max:255.0/255.0];
[blackAndWhiteGroup addFilter:satuaration];
[blackAndWhiteGroup addFilter:levels];
[satuaration addTarget:levels];
[blackAndWhiteGroup setInitialFilters:[NSArray arrayWithObject:satuaration]];
[blackAndWhiteGroup setTerminalFilter:levels];
I have tried two different ways for applying the filter to the image, neither are working for me but I think this is where my problem lies.
First attempt:
GPUImagePicture *stillImage= [[GPUImagePicture alloc] initWithImage:takenPhoto];
[stillImage addTarget:blackAndWhiteGroup];
[stillImage processImage];
UIImage *blackAndWhiteFilteredImage = [blackAndWhiteGroup imageFromCurrentFramebuffer];
self.imageView.image = blackAndWhiteFilteredImage;
Second attempt:
UIImage *blackAndWhiteFilteredImage = [blackAndWhiteGroup imageByFilteringImage:takenPhoto];
self.imageView.image = blackAndWhiteFilteredImage;
Thanks in advance.
Upvotes: 1
Views: 731
Reputation: 5902
As I stated in the comment, you need to call:
[blackAndWhiteGroup useNextFrameForImageCapture];
before calling:
[stillImage processImage];
This is for the updated version of the GPUImage library. Hope this helps out future questions!
Upvotes: 4