如何像素化/添加像素化效果到UIImage在iOS中 [英] How to pixelize / add pixelating effect to a UIImage in iOS
本文介绍了如何像素化/添加像素化效果到UIImage在iOS中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在寻找一种方法来像素化一个UIImage在Cocoa touch。我不知道什么最好的办法(有些人建议我使用OpenGL),但我有一种感觉,必须存在一些其他简单的方式,我可以俯瞰。有人知道吗?
I am looking for a way to pixelize a UIImage in Cocoa touch. I don't know what the best approach would be (some people have suggested me using OpenGL) but I have a feeling there must exist some other simple way I may be overlooking. Does anyone know of one?
推荐答案
信号处理说明如何处理图片:
Signal processing explanation of what to do to the image:
- Downsample by N
- Upsample by N
- Then convolve the image with a NxN box filter (Matlab code to create NxN box filter
rect = ones(N,N)
).
Comp sci说明:
Comp sci explanation:
- 创建一个大小相同的空白新图片
- 在原始图片中每隔N个像素迭代
- 在新图片中每第N个像素重复
这篇关于如何像素化/添加像素化效果到UIImage在iOS中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文