I wanted to add lipstick like effect on lips using CGMutable path. Detecting face landmarks using vision kit. Landmark.outer lips fill the whole lips, even opened mouth. i wanted to apply on the lips area only.
I have tried to play VNFaceLandmarkRegion2D.normalized path point but unable to achieve the result. Below is the code snippet.
let landmarkPath = CGMutablePath()
let landmarkPathPoints = eye.normalizedPoints
.map({ eyePoint in
CGPoint(
x: eyePoint.y * faceBoundingBox.height + faceBoundingBox.origin.x,
y: eyePoint.x * faceBoundingBox.width + faceBoundingBox.origin.y
)
})
landmarkPath.addLines(between: landmarkPathPoints)
landmarkPath.closeSubpath()
let landmarkLayer = CAShapeLayer()
landmarkLayer.path = landmarkPath
landmarkLayer.fillColor = nil
landmarkLayer.strokeColor = UIColor.green.cgColor
self.faceLayers.append(landmarkLayer)
self.view.layer.addSublayer(landmarkLayer)
New contributor
user25559454 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.