在目标 C 中创建类似 instagram 的移轴滤镜 [英] Create a tilt-shift filter like instagram in objective C

查看:15
本文介绍了在目标 C 中创建类似 instagram 的移轴滤镜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 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.

很抱歉我的演示很复杂,但很简单,我想为 iOS 创建一个 tilf-shift 工具,就像在 Instagram 中一样.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆