问题描述
所以...我有一个图像加载到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:
- 旋转图片
- 修剪其中的一部分并舍弃其余部分
- 应用阈值转换(基本上根据我提供的阈值将图像转换为黑白)
- 重新对图片进行重新取样,以缩小图片(虽然会损失一些图片品质,但会加快后续处理速度)
- Rotate the image
- Crop a portion of it and discard the rest
- Apply a "threshold" transformation (which essentially converts the image to black and white, based on the threshold value I provide)
- 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:
- a
- 缩放
- Rotate it
- Crop it
- Apply a threshold filter
- Scale it
这篇关于将变换应用于NSBitmapImageRep的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!