API Google Vision: Как обнаружить обнаруженное лицо - это изображение лица или настоящее живое лицо? - PullRequest
0 голосов
/ 28 сентября 2018

Я использую API Google Vision для определения лица в моем приложении.это работает нормально, но в моем случае мне нужно иметь дело только с реальными человеческими лицами.но мое приложение рассматривает лица на фотографии как лицо.но я хочу определить, какая фотография, а какая живая картинка.

ниже приведен класс графики лица

 private class GraphicFaceTracker extends Tracker<Face> {
    private GraphicOverlay mOverlay;
    private FaceGraphic mFaceGraphic;

    GraphicFaceTracker(GraphicOverlay overlay) {
        mOverlay = overlay;
        mFaceGraphic = new FaceGraphic(overlay);
    }

    /**
     * Start tracking the detected face instance within the face overlay.
     */
    @Override
    public void onNewItem(int faceId, Face item) {
        FaceTrackerActivity.faceId = faceId;
        mFaceGraphic.setId(faceId);
    }

    /**
     * Update the position/characteristics of the face within the overlay.
     */
    @Override
    public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
        mOverlay.add(mFaceGraphic);
        mFaceGraphic.updateFace(face);
       //here face detected live or image

    }

    /**
     * Hide the graphic when the corresponding face was not detected.  This can happen for
     * intermediate frames temporarily (e.g., if the face was momentarily blocked from
     * view).
     */
    @Override
    public void onMissing(FaceDetector.Detections<Face> detectionResults) {
        mOverlay.remove(mFaceGraphic);
    }

    /**
     * Called when the face is assumed to be gone for good. Remove the graphic annotation from
     * the overlay.
     */
    @Override
    public void onDone() {
        mOverlay.remove(mFaceGraphic);
        Log.d("Gajanand", "onDone: ");
    }

}

любая помощь?

...