0

I've used StackBlur for image blurring but it is too slow for big resolution photos... so I decided to swith to GPUImage library as everyone says it's the best one to use.

I've used just this one line of code to implement blur using StackBlur:

_editedImage = [_myImage stackBlur:round(self.blurSlider.value)]; 

But I can't figure out how to use GPUImage in the same manner...

There are a lot of examples on the web, but they are all outdated because of GPUImage updates..

Could someone please help me to implement gaussian blur?

Sorry if this sounds very stupid...I am new to objective-c.

2 Answers 2

1

You'd want to do something like this (untested though, so it might not work the first time ;)

- (UIImage*)blurImage { GPUImagePicture *source = [[GPUImagePicture alloc] initWithImage:self]; GPUImageiOSBlurFilter *blur = [[GPUImageiOSBlurFilter alloc] init]; blur.blurRadiusInPixels = 1.0f; [source addTarget:blur]; [blur processImage]; return [blur imageFromCurrentFramebuffer]; } 
Sign up to request clarification or add additional context in comments.

4 Comments

thank you, but Xcode gives error for: [filter imageFromCurrentFramebuffer] - Declaration of 'filter' must be imported from module 'Darwin.ncurses' before it is required; & Bad receiver type 'void (*)(void)';
Whoops. Change filter to source ;)
Updated the example, I think it's correct now. I always get confused with the way filters are chained.
thank you! I'll give it a try! But I've managed to use [Apple UIImageEffects] (developer.apple.com/library/ios/samplecode/UIImageEffects/…) and it works realy fast
1

this one is for GPUImageGaussianSelectiveBlurFilter.

i hope it helps you..

GPUImageGaussianSelectiveBlurFilter *selectiveBlur; GPUImagePicture *fx_image; UIImage *final_image; -(IBAction)upDateSliderValue:(id)sender { fx_image = [[GPUImagePicture alloc] initWithImage:originalImage]; [self aspectRatio]; //to get the Value of f.. [selectiveBlur setAspectRatio:f]; [selectiveBlur setExcludeCircleRadius:self.sliderChange.value]; [fx_image addTarget:selectiveBlur]; [fx_image processImage]; final_image = [selectiveBlur imageFromCurrentlyProcessedOutput]; selectedImageView.image = final_image; } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.