Проверьте, находится ли мое лицо обнаружения внутри овала - PullRequest
0 голосов
/ 22 апреля 2020

У меня есть этот макет:

enter image description here

Я создаю свой овал с помощью этого метода для добавления его в центр макета:

 public RectF createRect() {
        float desiredWidth= (float) (Constants.FACE_OVAL_WIDTH_XCENT - 0.1);
        float desiredHeight=Constants.FACE_OVAL_HEIGHT_XCENT;
        float centerWidth=width / 2;
        float centerheight=height /2;
        int left= (int) (centerWidth-(width*(desiredWidth/2)));
        int top=(int) (centerheight-(height*(desiredHeight/2)));
        int right=(int) (centerWidth+(width*(desiredWidth/2)));
        int bottom=(int) (centerheight+(height*(desiredHeight/2)));
        Rect rect = new Rect(left, top, right, bottom);
        rectAsF=new RectF((float)left,(float) top,(float) right,(float) bottom);
        return rectAsF;
    }

Так что теперь я иметь прямоугольные координаты.
Когда API Google обнаруживает лицо, у меня есть это значение:

Face face
face.getWidth() and face.getHeight() and face.getPoints().x and y

Мой вопрос:
Как проверить, находится ли мое лицо внутри овала?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...