简体   繁体   English

使用Apple FaceDetection SDK

[英]using apple faceDetection sdk

when i try to use apple faceDetection SDK it successfully detect the right eye position making bezier path over the two eyes. 当我尝试使用apple faceDetection SDK时,它成功检测到右眼位置,从而形成了两只眼睛之间的贝塞尔曲线。

i need Know to make image over the eye when it open and decrease the image width & height with the eye opening angle . 我需要知道睁开眼睛时要在眼睛上方成像,并随睁眼角度减小图像的宽度和高度。

i use this function but not give me correct result 我使用此功能但没有给我正确的结果

 func draw(points: [(x: CGFloat, y: CGFloat)]) {
        let newLayer = CAShapeLayer()
         newLayer.lineWidth = 2.0
         let path = UIBezierPath()

        path.move(to: CGPoint(x: points[0].x, y: points[0].y))
        for i in 0..<points.count - 1 {
            var point: CGPoint = .zero
            point = CGPoint(x: points[i].x, y: points[i].y)
            path.addLine(to: point)
            path.move(to: point)
            path.addLine(to: CGPoint(x: points[0].x, y: points[0].y))

        }

         newLayer.path = path.cgPath
         newLayer.contents = UIImage(named:"eye2.png")?.cgImage;
         newLayer.contentsGravity = kCAGravityResizeAspectFill
         newLayer.isGeometryFlipped = false

         print("Hello Swift",shapeLayer.bounds)

        shapeLayer.addSublayer(newLayer)

    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM