Wednesday, 21 August 2013

Using GPUImage to filter a view live

Using GPUImage to filter a view live

I am trying to use GPUImage to filter a view as it is updated in a kind of
iOS 7 style overlay. To do this I am running the following code on an
NSTimer, however my NSLog is showing that [self.backgroundUIImage
imageFromCurrentlyProcessedOutput] is returning (null) I know that the
view self.background is working properly as it is also added to the view
(self.finalImageView has also already been added to the view). I am not
sure whether I'm going about this the right way at all as there is no real
documentation on how to do this on the GPUImage github page. Does anybody
know if it is possible to use GPUImage in this way?
if (!self.backgroundUIImage) {
self.backgroundUIImage = [[GPUImageUIElement alloc]
initWithView:self.background];
GPUImageFastBlurFilter *fastBlur = [[GPUImageFastBlurFilter alloc]
init];
fastBlur.blurSize = 0.5;
[self.backgroundUIImage addTarget:fastBlur];
[self.backgroundUIImage update];
}
[self.backgroundUIImage update];
NSLog(@"image : %@",[self.backgroundUIImage
imageFromCurrentlyProcessedOutput]);
self.finalImageView.image = [self.backgroundUIImage
imageFromCurrentlyProcessedOutput];
[self bringSubviewToFront:self.finalImageView];

No comments:

Post a Comment