-1

Any idea, how can put lipstick on lips in face detection. i have done put color but i want to show Glossy and Shiny. Any Idea about How can use texture and shades in MLKit ios app

Simply I find Lips points and create CAShapelayer layer and after that fill the color. in ARKit we can use scenekit and sceneview so we add easily material and texture and all. but how can we use in mlkit

[![enter image description here][1]][1]

Q1. is that possible to use sceneview in mlkit for materials and textures.

Q2. or how can drawing image in all points like (lips, eye, eyebrow)

// MARK: Contour func
private func addContours(for face: VisionFace, width: CGFloat, height: CGFloat) {

      let facez = SCNScene()
    guard let facez =  SCNScene(named: "8.scn") else {
              return
          }
    facez.rootNode.scale = SCNVector3(1,1,1)
    let multipl :CGFloat = 200.0
    let xoff :CGFloat = 0.98
    let yoff : CGFloat = 1.76
    let xp = ((face.frame.origin.x) / multipl) - xoff

    let yp = ((face.frame.origin.y) / multipl) - yoff

    facez.rootNode.position = SCNVector3(xp, yp, -1)
    facez.rootNode.eulerAngles = SCNVector3(-1,1,0)
    cameraView.allowsCameraControl = true
    cameraView.autoenablesDefaultLighting = true
    cameraView.scene = facez

    let materials =  facez.rootNode.geometry?.firstMaterial
    materials?.diffuse.contents = UIColor.red


}

i tried like this and

    public static func addleftImage(
  atPoint point: CGPoint,
  to view: UIView,
  color: UIColor,
  radius: CGFloat
) {
  let divisor: CGFloat = 2.0
  let xCoord = point.x - radius / divisor
  let yCoord = point.y - radius / divisor
  let circleRect = CGRect(x: xCoord, y: yCoord, width: radius, height: radius)
  let circleView = UIImageView(frame: circleRect)
    circleView.image = #imageLiteral(resourceName: "leftEye")
  circleView.layer.cornerRadius = radius / divisor
  circleView.alpha = Constants.circleViewAlpha
  circleView.backgroundColor = color
  view.addSubview(circleView)
}

But no luck!

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
Krishna kushwaha
  • 275
  • 2
  • 11
  • Hello, I'm Looking for same functionality, as You have questioned. How did you achieve you goal ? What Did you use ? – iFateh Aug 25 '22 at 07:43
  • 1
    @iFateh I tried if it is help to you just check it https://github.com/kushwaha03/MakeupApp Note: you can aadded color or images acording you there is created via calayer – Krishna kushwaha Aug 25 '22 at 10:16

1 Answers1

0

Q1: I'm afraid that's out of the scope of mlkit.

Q2: if it helps, MLKit has a quickstart app in swift that can show contour points on the face: https://github.com/firebase/quickstart-ios/tree/master/mlvision/MLVisionExample

A transformMatrix was applied and this is the line to add contour points: https://github.com/firebase/quickstart-ios/blob/master/mlvision/MLVisionExample/ViewController.swift#L845

Julie Zhou
  • 126
  • 5