Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticker not properly set on face as per position of eye or face. #4

Open
HEMAL-PATEL opened this issue Jun 11, 2019 · 5 comments
Open

Comments

@HEMAL-PATEL
Copy link

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.............................

@poojan28
Copy link

i got same problem

@mhsnakdgn
Copy link

 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!

@gaetanozappi
Copy link
Owner

Hi @HEMAL-PATEL , @poojan28 , @JDevelopes : I can close the issue?

@AshishGarg1988
Copy link

It is not clear Solution as on first line
Face face = mFace;

and
canvas.drawBitmap(op, left, top, new Paint());
what is op ??

@Anonymousgaurav
Copy link

anyone solve accurate face sticker problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants