Open enzyme69 opened 7 years ago
Did you resolve the problem? If yes, can you share or commit your method?
Replace the convertPointsForFace
with below, and it will work.
func convertPointsForFace(_ landmark: VNFaceLandmarkRegion2D?, _ boundingBox: CGRect) {
if let points = landmark?.normalizedPoints {
let faceLandmarkPoints = points.map { (point: CGPoint) -> (x: CGFloat, y: CGFloat) in
let pointX = point.x * boundingBox.width + boundingBox.origin.x
let pointY = point.y * boundingBox.height + boundingBox.origin.y
return (x: pointX, y: pointY)
}
DispatchQueue.main.async {
self.draw(points: faceLandmarkPoints)
}
}
}
Thanks for your sharing!
Im still getting this with the new function: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [VNFaceLandmarkRegion2D normalizedPoints]: unrecognized selector sent to instance
Any ideas?
Thanks for sharing the code.
Revision: if let points = landmark?.normalizedPoints, let count = landmark?.pointCount {
But getting more errors: Cannot convert value of type '[CGPoint]' to expected argument type 'UnsafePointer' (aka 'UnsafePointer')