Изменить цвет фона на ограниченную область просмотра в Android - PullRequest
0 голосов
/ 02 июля 2019

Я занимаюсь разработкой приложения, использующего распознавание лиц.Мне удалось нарисовать изображение поверх камеры, но изображение не прозрачное.

face image

Я хочу, чтобы лицо было прозрачным, как у нас внастоящая камера.Я пытался подписаться на этот пост: Изменить цвет фона на ограниченную область просмотра - Android

Каков наилучший способ добиться этого?

Это моймакет:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:keepScreenOn="true"
    android:background="@android:color/black"
    android:orientation="vertical">

    <com.facekeyexample.views.AutoFitTextureView
        android:id="@+id/texture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />

    <TextView
        android:id="@+id/message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/darker_gray"
        android:ellipsize="end"
        android:gravity="center"
        android:maxLines="1"
        android:padding="12dp"
        android:text="@string/align_face"
        android:textColor="@android:color/white"
        android:textSize="16dp"
        android:textStyle="bold" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/message"
        android:alpha="0.77"
        android:background="@color/transparent_darkIndigo"
        android:orientation="vertical">

        <TextView
            android:id="@+id/counter"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_marginBottom="32dp"
            android:padding="5dp"
            android:text="3"
            android:textColor="@android:color/holo_orange_light"
            android:textSize="120dp"
            android:textStyle="bold"
            android:visibility="gone" />

        <View
            android:id="@+id/elipseShape"
            android:layout_width="320dp"
            android:layout_height="430dp"
            android:layout_centerInParent="true"
            android:background="@drawable/face"
            />


        <com.facekey.liveness.LivenessView
            android:id="@+id/livenessView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

        <ProgressBar
            android:id="@+id/progressBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:visibility="gone" />
    </RelativeLayout>
</RelativeLayout>

Спасибо

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