I am confused by why iOS requires a lot of conversion between image formats. For example, if I upload jpg to UIImage, and then want to do face detection on it, I need to create CIImage to go to CIDetector. Doesn't that mean getting into memory and performance?
Is this some kind of legacy thing between Core Graphics, Core Image and UIKit (and probably openGL ES, but I am not working with this)? Is the hit trivial in general?
I will do what I need to do, but I would like to know more about it. Also, I ran into problems sometimes doing conversions, and got confused about the differences between the formats.
Update
Good - so I just felt again confused about these formats (or the confusion of these formats ...). Half an hour has passed. That's what I'm doing:
Testing for faces in a local image, I created the necessary CIImage with:
CIImage *ciImage = [image CIImage];
and received no functions, no matter what orientation I went through. I know that this particular image worked with CIDetectorTypeFacebefore and that I ran into difficulties in the format CIImage. Having tried creating a CCImage as follows:
CIImage *ciImage = [CIImage imageWithCGImage:image.CGImage];
and Face Detection is working fine. Arrgh! I made sure [image CIImage]that the resulting CIImage was not a nickname. Therefore, I am confused. The first approach just gets a pointer, and the second creates a new CIImage. Does it matter?
Digging into the UIImage.h file, I see the following:
@property(nonatomic,readonly) CGImageRef CGImage;
@property(nonatomic,readonly) CIImage *CIImage;
, , - Beware: test for nil...