将变换应用于NSBitmapImageRep

将变换应用于NSBitmapImageRep

本文介绍了将变换应用于NSBitmapImageRep的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以...我有一个图像加载到NSBitmapImageRep对象,所以我能够通过二维数组检查特定像素的内容。现在我想对图像应用几个转换,为一些额外的处理做准备。如果我手动操作图片,在Photoshop中,我会:

So ... I have an image loaded into an NSBitmapImageRep object, so I am able to examine the contents of specific pixels via a two dimensional array. Now I want to apply a couple of "transformations" to the image, in preparation for some additional processing. If I was manipulating the image manually, in Photoshop, I would:


  1. 旋转图片

  2. 修剪其中的一部分并舍弃其余部分

  3. 应用阈值转换(基本上根据我提供的阈值将图像转换为黑白)

  4. 重新对图片进行重新取样,以缩小图片(虽然会损失一些图片品质,但会加快后续处理速度)

  1. Rotate the image
  2. Crop a portion of it and discard the rest
  3. Apply a "threshold" transformation (which essentially converts the image to black and white, based on the threshold value I provide)
  4. Resample the image to shrink it down a bit (which, although losing some image quality, will speed up the subsequent processing)

(不一定按照这个顺序)

(not necessarily in that order)

有没有客观的C方法来方便这些特定的图像处理,使用NSBitmapImageRep对象中的数据?如果是这样,有人可以指点一些好的例子吗?

Are there objective C methods available to facilitate these specific image manipulations, with the data in the NSBitmapImageRep object? If so, can someone point me to some good examples?

推荐答案

。然后您可以:

Create a CIImage for the CGImage of the bitmap image rep. Then you can:




  1. a

  2. 缩放

  1. Rotate it
  2. Crop it
  3. Apply a threshold filter
  4. Scale it

这篇关于将变换应用于NSBitmapImageRep的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:14