0
 public void connectLipLine(int start, int end, Bitmap bitmap, Canvas canvas) {
    Paint mPaint = new Paint();
    mPaint.setColor(Color.GREEN);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setStrokeWidth(1f);

    Path path = new Path();

    // Left lower lips
            path.reset();
    path.moveTo(landmark_pt_x.get(37), landmark_pt_y.get(37));
    Log.d(TAG + " connectLipLine", landmark_pt_label.get(39) + " end: " + landmark_pt_label.get(41));
    path.cubicTo(landmark_pt_x.get(40), landmark_pt_y.get(40),
            landmark_pt_x.get(41), landmark_pt_y.get(41),
            // bottom lip point
            landmark_pt_x.get(38), landmark_pt_y.get(38));

    Log.d(TAG, landmark_pt_x.get(40) + " " + landmark_pt_y.get(40) + " : " + landmark_pt_x.get(41) + " " + landmark_pt_y.get(41));
    canvas.drawPath(path, mPaint);

    path.reset();
    // bottom right lip point
    path.moveTo(landmark_pt_x.get(46), landmark_pt_y.get(46));
    Log.d(TAG + " connectLipLine", landmark_pt_label.get(39) + " end: " + landmark_pt_label.get(41));
    // Left lower lips
    path.cubicTo(landmark_pt_x.get(43), landmark_pt_y.get(43),
            landmark_pt_x.get(44), landmark_pt_y.get(44),
            // bottom lip point
            landmark_pt_x.get(38), landmark_pt_y.get(38));
    canvas.drawPath(path, mPaint);

    path.reset();
    // top left lip point
    path.moveTo(landmark_pt_x.get(37), landmark_pt_y.get(37));
    Log.d(TAG + " connectLipLine", landmark_pt_label.get(39) + " end: " + landmark_pt_label.get(41));

    path.cubicTo(landmark_pt_x.get(49), landmark_pt_y.get(49),
            landmark_pt_x.get(48), landmark_pt_y.get(48),
    //top middle point
            landmark_pt_x.get(54), landmark_pt_y.get(54));

    canvas.drawPath(path, mPaint);

    path.reset();
     //top right lip point
    path.moveTo(landmark_pt_x.get(46), landmark_pt_y.get(46));
    Log.d(TAG + " connectLipLine", landmark_pt_label.get(39) + " end: " + landmark_pt_label.get(41));

    path.cubicTo(landmark_pt_x.get(52), landmark_pt_y.get(52),
            landmark_pt_x.get(51), landmark_pt_y.get(51),
            landmark_pt_x.get(54), landmark_pt_y.get(54));

    canvas.drawPath(path, mPaint);

    //inside lower
    //start from left
    path.reset();
    path.moveTo(landmark_pt_x.get(37), landmark_pt_y.get(37));
    path.quadTo(
            landmark_pt_x.get(39), landmark_pt_y.get(39),
            landmark_pt_x.get(45), landmark_pt_y.get(45));

    canvas.drawPath(path, mPaint);

    //inside lower
    //start from right
    path.reset();
    path.moveTo(landmark_pt_x.get(46), landmark_pt_y.get(46));
    path.quadTo(
            landmark_pt_x.get(42), landmark_pt_y.get(42),
            landmark_pt_x.get(45), landmark_pt_y.get(45));

    canvas.drawPath(path, mPaint);

    //inside upper
    //start from left
    path.reset();
    path.moveTo(landmark_pt_x.get(37), landmark_pt_y.get(37));
    path.quadTo(
            landmark_pt_x.get(50), landmark_pt_y.get(50),
            landmark_pt_x.get(47), landmark_pt_y.get(47));

    canvas.drawPath(path, mPaint);

    //inside upper
    //start from right
    path.reset();
    path.moveTo(landmark_pt_x.get(46), landmark_pt_y.get(46));
    path.quadTo(
            landmark_pt_x.get(53), landmark_pt_y.get(53),
            landmark_pt_x.get(47), landmark_pt_y.get(47));

    canvas.drawPath(path, mPaint);

}

Result: enter image description here

I have used face++ api to detect the landmark feature and use the point to enclosed an area but I hope to fill the enclosed area of the upper and lower lips. How can I do this in android? The above is the code that I enclose the area. Please give me some helps to fill the upper and lower lips.

Also, one more question. May I use HSV color space to set the color of the paint instead of using RGB and may I only change the H value of each pixel so that it will not change the brightness of the image? Thank you very much.

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
ng2b30
  • 351
  • 6
  • 18

0 Answers0