开发者

Applying transformations to NSBitmapImageRep

开发者 https://www.devze.com 2023-01-02 15:39 出处:网络
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\" t

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. 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)

Are there objec开发者_开发百科tive 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. Rotate it
  2. Crop it
  3. Apply a threshold filter
  4. Scale it
0

精彩评论

暂无评论...
验证码 换一张
取 消