Android-face-filters
Android-face-filters copied to clipboard
Sticker not properly set on face as per position of eye or face.
I have used this demo to implement live stickers on the face. But there is an issue that sticker does not set on the face properly. For example, glasses do not set on the eye position of the face. The similarly same thing happens for the other stickers.
Can you help I resolved this issue?
Please reply soon.............................
i got same problem
Face face = mFace;
if (face == null) return;
// Draws a circle at the position of the detected face, with the face's track id below.
float x = translateX(face.getPosition().x + face.getWidth() / 2);
float y = translateY(face.getPosition().y + face.getHeight() / 2);
/*
canvas.drawCircle(x, y, FACE_POSITION_RADIUS, mFacePositionPaint);
canvas.drawText("id: " + mFaceId, x + ID_X_OFFSET, y + ID_Y_OFFSET, mIdPaint);
canvas.drawText("happiness: " + String.format("%.2f", face.getIsSmilingProbability()), x - ID_X_OFFSET, y - ID_Y_OFFSET, mIdPaint);
canvas.drawText("right eye: " + String.format("%.2f", face.getIsRightEyeOpenProbability()), x + ID_X_OFFSET * 2, y + ID_Y_OFFSET * 2, mIdPaint);
canvas.drawText("left eye: " + String.format("%.2f", face.getIsLeftEyeOpenProbability()), x - ID_X_OFFSET*2, y - ID_Y_OFFSET*2, mIdPaint);
*/
float xOffset = scaleX(face.getWidth()/2.00f);
float yOffset = scaleY(face.getHeight()/1.20f);
float left = x - xOffset;
float top = y - yOffset;
//float right = x + xOffset;
//float bottom = y + yOffset;
//canvas.drawRect(left, top, right, bottom, mBoxPaint);
canvas.drawBitmap(op, left, top, new Paint());
after changing draw method like this, it is solved!
Hi @HEMAL-PATEL , @poojan28 , @JDevelopes : I can close the issue?
It is not clear Solution as on first line
Face face = mFace;
and
canvas.drawBitmap(op, left, top, new Paint());
what is op ??
anyone solve accurate face sticker problem?