try this:
typedef struct _rgbPixel {
uint8_t a;
uint8_t b;
uint8_t g;
uint8_t r;
} RGBPixel;
RGBPixel *getRawValuesFromImage(UIImage *srcImage, int width, int height) {
RGBPixel *rgbImage=(RGBPixel *) malloc(width*height*sizeof(RGBPixel));
CGColorSpaceRef colorSpace=CGColorSpaceCreateDeviceRGB();
CGContextRef context=CGBitmapContextCreate(rgbImage, width, height, 8, width*4, colorSpace, kCGBitmapByteOrder32Little|kCGImageAlphaNoneSkipLast);
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
CGContextSetShouldAntialias(context, NO);
CGContextDrawImage(context, CGRectMake(0, 0, width, height), [srcImage CGImage]);
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
return rgbImage;
}
The image normalisation just stretches the range of values so that they are in the rand 0-255. If you want to brighten an image then you need to increase the value of each pixel (but don't forget that the maximum pixel value is 255).