Getting data from an UIImage
Hi, I'm making a barcode reader for the iPhone.
I've captured a picture to an UIImage, but now I want to access the data and analyse them. Really, I just want the middle row, converted to greyscale, for now I want to discard the rest. However, UIImage doesn't give me access to the raw data, I have to convert it to either PNG or JPEG in an NSData using functions like UIImagePNGRepresentation(image). That's fine, but how do I continue to convert a PNG file to raw pixels?
UIImage has provided me with the dimensions of the picture, and I expect the pixels to be in ARGB format, but I haven't found the equivalent of NSBitmapImageRep in the SDK. Any suggestions on how I can convert an NSData* with a ARGB PNG image into a grayscale NSArray* of int or similar?
Cheers
Nik
|