在物镜C中创建像instagram这样的倾斜移位滤镜 [英] Create a tilt-shift filter like instagram in objective C
问题描述
我试图在iOS中创建像instagram或iDarkroom这样的图像的倾斜移位滤镜。
I trying to create a tilt-shift filter of the image like instagram or iDarkroom in iOS.
我提出的方法是对部分图像使用不同的高斯模糊等级。但我不知道如何控制区域以应用不同的高斯模糊等级,特别是当用户可以通过旋转,缩放等改变效果区域时。
My proposed method is use different Gaussian Blur levels for the partial image. But I don't known how to control the area to apply different Gaussian Blur Levels, especially when User can change the effect area by rotate, scale, etc.
抱歉我的复杂演示,但简单地说,我想像在Instagram中一样为iOS创建一个tilf-shift工具。
Sorry about my complex presentation but simply, I want to create a tilf-shift tool for iOS like in Instagram.
我搜索并找到了这个功能强大的框架 https:// github.com/BradLarson/GPUImage ,但如果将这个庞大的框架包含在我的小应用程序中,这不是一个好的解决方案
I search and found this powerful framework https://github.com/BradLarson/GPUImage, but it's not good solution if include this huge framework to my tiny apps
推荐答案
我找到了解决方案:
使用过滤器 GPUImageGaussianSelectiveBlurFilter 并在此代码中更改计算 distanceFromCenter :
Use filter GPUImageGaussianSelectiveBlurFilter and change computing distanceFromCenter on this code:
distanceFromCenter = abs((textureCoordinate2.x - excludeCirclePoint.x) *
aspectRatio*cos(angle) + (textureCoordinate2.y-excludeCirclePoint.y)*sin(angle));
这篇关于在物镜C中创建像instagram这样的倾斜移位滤镜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!