ios - GPUImageGaussianSelectiveBlurFilter选择区域问题

标签 ios objective-c cocoa-touch ios7 gpuimage

我使用了 GPUImageGaussianSelectiveBlurFilter

    imagePic = [[GPUImagePicture alloc] initWithImage:captureImage];// given a input in gpuimagepicture for process a image
filter = [[GPUImageGaussianSelectiveBlurFilter alloc] init];
[imagePic addTarget:filter];// add a filter for image

// create  a view for set a image in that view
imageViewGpu=[[GPUImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-OutputImageView.frame.size.width)/2.0, (biManager.displayImageHeight-OutputImageView.frame.size.height)/2.0, OutputImageView.frame.size.width, OutputImageView.frame.size.height)];
imageViewGpu.userInteractionEnabled = YES;

imageViewGpu.frame=OutputImageView.frame;
imageViewGpu.multipleTouchEnabled= YES;
imageViewGpu.backgroundColor = [UIColor clearColor];
imageViewGpu.userInteractionEnabled = YES;
imageViewGpu.fillMode=kGPUImageFillModePreserveAspectRatio;
[self.view addSubview:imageViewGpu];
[(GPUImageGaussianSelectiveBlurFilter *) filter setExcludeCircleRadius:0.3f];

[(GPUImageGaussianSelectiveBlurFilter *) filter setExcludeCirclePoint:CGPointMake(0,0)];
[filter addTarget:imageViewGpu];
[filter prepareForImageCapture];
[imagePic processImage];// get a filter apply image

我的输出是

enter image description here

但是我需要这个输出

enter image description here

我认为这个滤镜非常适合方形图像。但它不能正确处理矩形图像。请帮助我。

最佳答案

将过滤器的 aspectRatio 属性设置为图像的纵横比。

filter.aspectRatio = imagePix.size.width/imagePix.size.height

如果这不起作用交换宽度/高度 :]

关于ios - GPUImageGaussianSelectiveBlurFilter选择区域问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21729307/

相关文章:

iphone - 将 CGPDFPageRef 转换为整数

ios - AVAsset Export 设置恒定的帧率

objective-c - 在没有\n的情况下在 UITextView 中显示段落

ios - UICollectionViewLayout 小型和大型单元自动布局

ios - AudioKit 4.3 : record audio, 离线渲染,然后播放

ios - NSStringboundingRectWithSize 在 iOS 9 上有 bug?

iOS 6 vs 7 外观build设置

iphone - 从我的应用程序启动 Facebook 应用程序并让它打开一个不是我的个人资料

iphone - Instagram 或 Hipstamatic 如何进行照片滤镜?

iphone - 以编程方式生成 HTML