How to pixelize / add pixelating effect to a UIImage in iOS

孤人 提交于 2020-01-01 19:49:07

问题


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?


回答1:


Signal processing explanation of what to do to the image:

  1. Downsample by N
  2. Upsample by N
  3. Then convolve the image with a NxN box filter (Matlab code to create NxN box filterrect = ones(N,N)).

Comp sci explanation:

  1. create an empty new image that is the same size
  2. iterate over every Nth pixel in the original image
  3. repeat every Nth pixel in the new image


来源:https://stackoverflow.com/questions/6853376/how-to-pixelize-add-pixelating-effect-to-a-uiimage-in-ios

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