android/src/main/java/io/github/edufolly/fluttermobilevision/face/FaceGraphic.java
@Override
    public void draw(Canvas canvas) {
        Face face = this.face;
        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);

        if (showText) {
            canvas.drawCircle(x, y, FACE_POSITION_RADIUS, facePositionPaint);

            canvas.drawText("id: " + getId(), x + ID_X_OFFSET, y + ID_Y_OFFSET, idPaint);

            canvas.drawText("happiness: " + String.format("%.2f", face.getIsSmilingProbability()),
                    x - ID_X_OFFSET, y - ID_Y_OFFSET, idPaint);

            canvas.drawText("right eye: " + String.format("%.2f", face.getIsRightEyeOpenProbability()),
                    x + ID_X_OFFSET * 2, y + ID_Y_OFFSET * 2, idPaint);

            canvas.drawText("left eye: " + String.format("%.2f", face.getIsLeftEyeOpenProbability()),
                    x - ID_X_OFFSET * 2, y - ID_Y_OFFSET * 2, idPaint);
        }

        // Draws a bounding box around the face.
        canvas.drawRect(getBoundingBox(), boxPaint);
    }
/**
     * Draws the face annotations for position on the supplied canvas.
     */
Draws the face annotations for position on the supplied canvas.
Draws the face annotations for position on the supplied canvas .
@Override
    public void draw(Canvas canvas) {
        Face face = this.face;
        if (face == null) {
            return;
        }
        float x = translateX(face.getPosition().x + face.getWidth() / 2);
        float y = translateY(face.getPosition().y + face.getHeight() / 2);
        if (showText) {
            canvas.drawCircle(x, y, FACE_POSITION_RADIUS, facePositionPaint);
            canvas.drawText("id: " + getId(), x + ID_X_OFFSET, y + ID_Y_OFFSET, idPaint);
            canvas.drawText("happiness: " + String.format("%.2f", face.getIsSmilingProbability()),
                    x - ID_X_OFFSET, y - ID_Y_OFFSET, idPaint);
            canvas.drawText("right eye: " + String.format("%.2f", face.getIsRightEyeOpenProbability()),
                    x + ID_X_OFFSET * 2, y + ID_Y_OFFSET * 2, idPaint);
            canvas.drawText("left eye: " + String.format("%.2f", face.getIsLeftEyeOpenProbability()),
                    x - ID_X_OFFSET * 2, y - ID_Y_OFFSET * 2, idPaint);
        }
        canvas.drawRect(getBoundingBox(), boxPaint);
    }
@ Override public void draw ( Canvas canvas ) { Face face = this . face ; if ( face == null ) { return ; } float x = translateX ( face . getPosition ( ) . x + face . getWidth ( ) / 2 ) ; float y = translateY ( face . getPosition ( ) . y + face . getHeight ( ) / 2 ) ; if ( showText ) { canvas . drawCircle ( x , y , FACE_POSITION_RADIUS , facePositionPaint ) ; canvas . drawText ( "id: " + getId ( ) , x + ID_X_OFFSET , y + ID_Y_OFFSET , idPaint ) ; canvas . drawText ( "happiness: " + String . format ( "%.2f" , face . getIsSmilingProbability ( ) ) , x - ID_X_OFFSET , y - ID_Y_OFFSET , idPaint ) ; canvas . drawText ( "right eye: " + String . format ( "%.2f" , face . getIsRightEyeOpenProbability ( ) ) , x + ID_X_OFFSET * 2 , y + ID_Y_OFFSET * 2 , idPaint ) ; canvas . drawText ( "left eye: " + String . format ( "%.2f" , face . getIsLeftEyeOpenProbability ( ) ) , x - ID_X_OFFSET * 2 , y - ID_Y_OFFSET * 2 , idPaint ) ; } canvas . drawRect ( getBoundingBox ( ) , boxPaint ) ; }
Draws the face annotations for position on the supplied canvas.
Draws the face annotations for position on the supplied canvas .
// Draws a circle at the position of the detected face, with the face's track id below. // Draws a bounding box around the face.