I am trying to figure out how to convert the CGPoint results returned from CIFaceFeature to paint with them in CALayer . I used to normalize my image to have a 0 turn to simplify the task, but this creates problems for images taken with a device in landscape mode.
I have been working on this for some time without success, and I'm not sure that my understanding of the problem is wrong, or my approach is wrong, or both. Here is what I think is right:

According to the documentation for the CIDetector featuresInImage:options: method featuresInImage:options:
A dictionary that specifies the orientation of the image. The detection is adjusted to account for the image orientation but the coordinates in the returned feature objects are based on those of the image.

In the code below, I am trying to rotate CGPoint to draw it through a CAShape layer that overlays a UIImageView.
What I'm doing (... or I think I'm doing ...) translates the left eye of the CGPoint into the center of view, rotating 90 degrees, and then moving the point back to where it was. This is not true, but I do not know where I am mistaken. Is my approach wrong or the way I implement it?
#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)
- leftEyePosition is a CGPoint
CGAffineTransform transRot = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); float x = self.center.x; float y = self.center.y; CGAffineTransform tCenter = CGAffineTransformMakeTranslation(-x, -y); CGAffineTransform tOffset = CGAffineTransformMakeTranslation(x, y); leftEyePosition = CGPointApplyAffineTransform(leftEyePosition, tCenter); leftEyePosition = CGPointApplyAffineTransform(leftEyePosition, transRot); leftEyePosition = CGPointApplyAffineTransform(leftEyePosition, tOffset);
From this post: stack overflow
Orientation
Apple / UIImage.imageOrientation Jpeg / File kCGImagePropertyOrientation
UIImageOrientationUp = 0 = Landscape left = 1 UIImageOrientationDown = 1 = Landscape right = 3 UIImageOrientationLeft = 2 = Portrait down = 8 UIImageOrientationRight = 3 = Portrait up = 6
Post edited by skinnyTOD - 02/113 at 16:09