我已经使用StackBlur进行图像模糊但对于大分辨率照片来说太慢了......所以我决定转向GPUImage library,因为每个人都说它是最好的一个人可以使用。
我只使用这一行代码来使用StackBlur实现模糊:
_editedImage = [_myImage stackBlur:round(self.blurSlider.value)];
但是我无法以同样的方式弄清楚如何使用GPUImage ......
网上有很多例子,但由于GPUImage的更新,它们都已经过时了。
有人可以帮助我实施高斯模糊吗?
很抱歉,如果这听起来很愚蠢......我是Objective-c的新手。
答案 0 :(得分:1)
你想做这样的事情(虽然未经测试,但第一次可能无效;)
- (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];
}
答案 1 :(得分:1)
这个是GPUImageGaussianSelectiveBlurFilter。
我希望它可以帮助你......
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;
}