Created
December 12, 2019 01:19
-
-
Save ozgurshn/3b54052f8d28eb3bace0ff3aef1585bb to your computer and use it in GitHub Desktop.
Apple Vision face landmark projection in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func getTransformedPoints( | |
| landmark:VNFaceLandmarkRegion2D, | |
| faceRect:CGRect, | |
| imageSize:CGSize) -> [CGPoint]{ | |
| // last point is 0.0 | |
| return landmark.normalizedPoints.map({ (np) -> CGPoint in | |
| return CGPoint( | |
| x: faceRect.origin.x + np.x * faceRect.size.width, | |
| y: imageSize.height - (np.y * faceRect.size.height + faceRect.origin.y)) | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment