Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing GPUImage to filter a view live
    primarykey
    data
    text
    <p>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 <code>[self.backgroundUIImage imageFromCurrentlyProcessedOutput]</code> 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?</p> <pre><code>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]; </code></pre> <p><strong>EDIT 1</strong></p> <p>I have now looked at the FilterShowcase example code, and I'm therefore now trying to implement the live blur like so : </p> <pre><code>NSLog(@"regenerating view"); if (!self.backgroundUIImage) { GPUImageAlphaBlendFilter *blendFilter = [[GPUImageAlphaBlendFilter alloc] init]; blendFilter.mix = 1.0; self.backgroundUIImage = [[GPUImageUIElement alloc] initWithView:self.background]; NSLog(@"self.backgroundUIImage : %@",self.backgroundUIImage); self.filter = [[GPUImageFastBlurFilter alloc] init]; self.filter.blurSize = 10; [self.filter addTarget:blendFilter]; [self.backgroundUIImage addTarget:blendFilter]; [blendFilter addTarget:self.finalImageView]; __unsafe_unretained GPUImageUIElement *weakUIElementInput = self.backgroundUIImage; [self.filter setFrameProcessingCompletionBlock:^(GPUImageOutput * filter, CMTime frameTime){ [weakUIElementInput update]; }]; } __unsafe_unretained GPUImageUIElement *weakUIElementInput = self.backgroundUIImage; [self.filter setFrameProcessingCompletionBlock:^(GPUImageOutput * filter, CMTime frameTime){ [weakUIElementInput update]; }]; [self bringSubviewToFront:self.finalImageView]; </code></pre> <p>Where the @properties are set up like so : </p> <pre><code>@property (nonatomic, strong) GPUImageView *finalImageView; @property (nonatomic, strong) SMBouncingBubblesBackground *background; @property (nonatomic, strong) GPUImageUIElement *backgroundUIImage; @property (nonatomic, strong) GPUImageFastBlurFilter *filter; </code></pre> <p>This looks like it's not generating an image as I can see the background view through self.finalImageView. Some documentation for how to do this would be really great!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload