Create a tilt-shift filter like instagram in objective C

ぃ、小莉子 提交于 2019-11-29 23:53:22

问题


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.

Sorry about my complex presentation but simply, I want to create a tilf-shift tool for iOS like in Instagram.

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


回答1:


I found solution:

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));



回答2:


GPUImage framework worked perfectly for my question. GPUImageGaussianSelectiveBlurFilter for radial tiltshif as Oleg Kovtun's answer above and GPUImageTiltShiftFilter for linear one.

Update answer for someone need



来源:https://stackoverflow.com/questions/11256100/create-a-tilt-shift-filter-like-instagram-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!