人脸图像调整
This commit is contained in:
parent
48b710d7cc
commit
65ab7ad7a3
|
|
@ -26,6 +26,8 @@ import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewOutlineProvider;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
@ -187,6 +189,16 @@ public class FaceFragment extends BaseFragment<ActivityFaceBinding> {
|
||||||
protected void initViews() {
|
protected void initViews() {
|
||||||
previewView = findViewById(R.id.texture_preview);
|
previewView = findViewById(R.id.texture_preview);
|
||||||
faceRectView = findViewById(R.id.face_rect_view);
|
faceRectView = findViewById(R.id.face_rect_view);
|
||||||
|
FrameLayout faceRectContainer = findViewById(R.id.face_rect_view_container);
|
||||||
|
|
||||||
|
// 设置为圆形
|
||||||
|
faceRectContainer.setOutlineProvider(new ViewOutlineProvider() {
|
||||||
|
@Override
|
||||||
|
public void getOutline(View view, android.graphics.Outline outline) {
|
||||||
|
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), view.getWidth() / 2f);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
faceRectContainer.setClipToOutline(true);
|
||||||
compareResultList = new ArrayList<>();
|
compareResultList = new ArrayList<>();
|
||||||
SIMILAR_THRESHOLD = Float.parseFloat(WorkConfig.getFacePassRate());
|
SIMILAR_THRESHOLD = Float.parseFloat(WorkConfig.getFacePassRate());
|
||||||
adapter = new FaceSearchResultAdapter(compareResultList, requireContext());
|
adapter = new FaceSearchResultAdapter(compareResultList, requireContext());
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="oval">
|
android:shape="oval">
|
||||||
<solid android:color="@android:color/transparent"/>
|
<solid android:color="#00000000" /> <!-- 透明 -->
|
||||||
|
<stroke
|
||||||
|
android:width="3dp"
|
||||||
|
android:color="#4BCFCF" /> <!-- 圆形边框(可选) -->
|
||||||
</shape>
|
</shape>
|
||||||
|
|
@ -172,7 +172,22 @@
|
||||||
android:id="@+id/face_rect_view_container"
|
android:id="@+id/face_rect_view_container"
|
||||||
android:layout_width="470dp"
|
android:layout_width="470dp"
|
||||||
android:layout_height="470dp"
|
android:layout_height="470dp"
|
||||||
|
android:background="@drawable/face_bg"
|
||||||
|
android:padding="1px"
|
||||||
android:layout_gravity="center">
|
android:layout_gravity="center">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="#50000000"
|
||||||
|
android:elevation="999dp"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="检测中"
|
||||||
|
android:textSize="25sp"
|
||||||
|
android:textColor="@color/white"/>
|
||||||
|
</LinearLayout>
|
||||||
<TextureView
|
<TextureView
|
||||||
android:id="@+id/texture_preview"
|
android:id="@+id/texture_preview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue