Artem Novichkov
Artem Novichkov

Reputation: 2341

Deprecation of VNFaceLandmarkRegion2D's points

I have installed Xcode beta 5. Now I have a warning related to Vision framework and VNFaceLandmarkRegion2D object especially:

'point(at:)' was deprecated in iOS 11.0

Regarding to documentation point(at:) and points were introduced and deprecated in iOS 11. Anyway, now I can get a face landmark points?

Upvotes: 2

Views: 3136

Answers (2)

Pooja Gupta
Pooja Gupta

Reputation: 333

You can try the alternative for points(at:) like this:

if let landmark = face.landmarks?.leftEye {
        for i in 0...landmark.pointCount - 1 { // last point is 0,0
            let point = landmark.normalizedPoints[i]
            if i == 0 {
                context?.move(to: CGPoint(x: x + CGFloat(point.x) * w, y: y + CGFloat(point.y) * h))
            } else {
                context?.addLine(to: CGPoint(x: x + CGFloat(point.x) * w, y: y + CGFloat(point.y) * h))
            }
        }
    }

Upvotes: 2

Artem Novichkov
Artem Novichkov

Reputation: 2341

In last Xcode updates VNFaceLandmarkRegion2D was changed. And now it is no needed to convert x and y into CGPoint object. VNFaceLandmarkRegion2D has normalizedPoints, an array of CGPoints.

Upvotes: 7

Related Questions