While doing face detection work with CIFaceFeature
, I ran into an issue with the bounds. While trying to put a box around the recognized face, the frame would always be misplaced. Other questions on Stack Overflow point out that the Core Image and UIKit coordinate systems are inverted.
(These images are from https://nacho4d-nacho4d.blogspot.com/2012/03/coreimage-and-uikit-coordinates.html)
Obviously, this coordinate system difference is the reason for the frame misplacement. Now, the x-axis, width, and height remain the same. The only difference is the y. Other answers on Stack Overflow suggest (image height - face y) / 2
as the solution. This generally works, but for some faces, you'll find that it's wildly wrong.