Shapes from VNDetectFaceLandmarksRequest are sideways

I'm trying to set up an app that will detect the locations of the face/the facial landmarks in a still image using VNDetectFaceLandmarksRequest. For some reason though, when I draw the detected facial landmarks they show up in the correct location but rotated about 90 degrees. What gives?

I've tried setting the orientation of the VNImageRequestHandler to be .left instead of .up on line 66, and that fixes the orientation of the face but gives it a strange offset away from the face. I've tried rotating the calculated landmarkLayer as things are being calculated but I think I don't understand CAShapeLayer transform manipulation enough to get it to be positioned how I'd like.

It seems that you have a coordinate space conversion issue. When debugging this sort of issue, it is often useful to identify, and make sure that you fully understand, both the “source” coordinate space and the “destination” coordinate space.

Once you have a clear mental picture of the source and destination spaces, you can attempt to construct a transformation that converts points in the source coordinate space to the destination coordinate space. To test your transformation, you can attempt to convert a known point in the source coordinate space to a point in the destination coordinate space. If the point does not end up where you expected it to, then you should re-check your assumptions about the source and destination spaces.

Try using this approach to convert your points, if you require further assistance, please Request Technical Support.

Shapes from VNDetectFaceLandmarksRequest are sideways
 
 
Q