-
11app/src/main/AndroidManifest.xml
-
81app/src/main/java/com/baidu/idl/face/main/finance/utils/TestPopWindow.java
-
26app/src/main/java/com/ouxuan/oxface/DebugActivity.java
-
125app/src/main/java/com/ouxuan/oxface/MainActivity.java
-
547app/src/main/java/com/ouxuan/oxface/OXFaceOnlineActivity.java
-
12app/src/main/res/drawable/finance_radius.xml
-
5app/src/main/res/drawable/gate_imageview_radius.xml
-
13app/src/main/res/drawable/gate_radius_compare.xml
-
10app/src/main/res/drawable/spot.xml
-
7app/src/main/res/layout/activity_debug.xml
-
219app/src/main/res/layout/activity_oxface_online.xml
-
124app/src/main/res/layout/layout_by_living_detection.xml
-
119app/src/main/res/layout/layout_failed_in_vivo_test.xml
-
37app/src/main/res/layout/layout_hint.xml
-
70app/src/main/res/layout/layout_no_face_detected.xml
-
108app/src/main/res/layout/layout_quality_test_failed.xml
-
BINapp/src/main/res/mipmap-hdpi/ic_finance_back.png
-
BINapp/src/main/res/mipmap-hdpi/ic_finance_setting.png
-
BINapp/src/main/res/mipmap-hdpi/ic_finance_view.png
-
BINapp/src/main/res/mipmap-hdpi/ic_icon_develop_fail.png
-
BINapp/src/main/res/mipmap-hdpi/ic_icon_develop_success.png
-
BINapp/src/main/res/mipmap-hdpi/ic_image_video.png
-
BINapp/src/main/res/mipmap-hdpi/ic_loading_blue.png
-
BINapp/src/main/res/mipmap-hdpi/ic_loading_grey.png
-
BINapp/src/main/res/mipmap-xxhdpi/ic_finance_back.png
-
BINapp/src/main/res/mipmap-xxhdpi/ic_finance_setting.png
-
BINapp/src/main/res/mipmap-xxhdpi/ic_finance_view.png
-
BINapp/src/main/res/mipmap-xxhdpi/ic_icon_develop_fail.png
-
BINapp/src/main/res/mipmap-xxhdpi/ic_icon_develop_success.png
-
BINapp/src/main/res/mipmap-xxhdpi/ic_image_video.png
-
BINapp/src/main/res/mipmap-xxhdpi/ic_loading_blue.png
-
BINapp/src/main/res/mipmap-xxhdpi/ic_loading_grey.png
-
17app/src/main/res/values/colors.xml
-
63app/src/main/res/values/dimens.xml
-
24financelibrary/src/main/java/com/baidu/idl/face/main/finance/manager/FaceSDKManager.java
-
16financelibrary/src/main/java/com/baidu/idl/face/main/finance/utils/BitmapUtils.java
@ -0,0 +1,81 @@ |
|||||
|
package com.baidu.idl.face.main.finance.utils; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.util.Log; |
||||
|
import android.view.Gravity; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.widget.PopupWindow; |
||||
|
|
||||
|
import com.baidu.idl.main.facesdk.financelibrary.R; |
||||
|
|
||||
|
public class TestPopWindow extends PopupWindow { |
||||
|
private String TAG = "TestPopWindow"; |
||||
|
private final Context gContext; |
||||
|
private View view; |
||||
|
|
||||
|
public TestPopWindow(Context context) { |
||||
|
this(context, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
||||
|
Log.d(TAG, "TestPopWindow: " + ViewGroup.LayoutParams.WRAP_CONTENT |
||||
|
+ "bbb:" + ViewGroup.LayoutParams.WRAP_CONTENT); |
||||
|
} |
||||
|
|
||||
|
public TestPopWindow(Context context, int width, int height) { |
||||
|
super(context); |
||||
|
this.gContext = context; |
||||
|
view = View.inflate(context, R.layout.layout_no_face_detected, null); |
||||
|
view.findViewById(R.id.retest_detectBtn).setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
mOnClickFinance.rester(true); |
||||
|
} |
||||
|
}); |
||||
|
view.findViewById(R.id.back_homeBtn).setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
mOnClickFinance.rester(false); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
setContentView(view); |
||||
|
// 设置窗口的高和宽 |
||||
|
setWidth(width); |
||||
|
setHeight(height); |
||||
|
// 设置弹窗内科点击 |
||||
|
setTouchable(true); |
||||
|
setOutsideTouchable(true); |
||||
|
setFocusable(true); |
||||
|
// TODO去除背景 |
||||
|
setBackgroundDrawable(null); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 显示popupWindow |
||||
|
*/ |
||||
|
public void showPopupWindow(View parent) { |
||||
|
if (!this.isShowing()) { |
||||
|
// 以下拉方式显示popupwindow,调整位置使其不会完全遮挡预览界面 |
||||
|
this.showAtLocation(parent, Gravity.CENTER, 0, -50); |
||||
|
} else { |
||||
|
this.dismiss(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void closePopupWindow() { |
||||
|
if (this.isShowing()) { |
||||
|
this.dismiss(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void setmOnClickFinance(OnClickFinance mOnClickFinance) { |
||||
|
this.mOnClickFinance = mOnClickFinance; |
||||
|
} |
||||
|
|
||||
|
public OnClickFinance mOnClickFinance; |
||||
|
|
||||
|
public interface OnClickFinance { |
||||
|
void rester(boolean isReTest); |
||||
|
} |
||||
|
} |
@ -0,0 +1,547 @@ |
|||||
|
package com.ouxuan.oxface; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.content.pm.PackageManager; |
||||
|
import android.graphics.Bitmap; |
||||
|
import android.graphics.Canvas; |
||||
|
import android.graphics.Color; |
||||
|
import android.graphics.Paint; |
||||
|
import android.graphics.PorterDuff; |
||||
|
import android.graphics.RectF; |
||||
|
import android.hardware.Camera; |
||||
|
import android.os.Bundle; |
||||
|
import android.os.Handler; |
||||
|
import android.util.Log; |
||||
|
import android.view.TextureView; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.ImageView; |
||||
|
import android.widget.RelativeLayout; |
||||
|
import android.widget.TextView; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.core.app.ActivityCompat; |
||||
|
import androidx.core.content.ContextCompat; |
||||
|
|
||||
|
import com.baidu.idl.face.main.finance.activity.BaseActivity; |
||||
|
import com.baidu.idl.face.main.finance.callback.CameraDataCallback; |
||||
|
import com.baidu.idl.face.main.finance.callback.FaceDetectCallBack; |
||||
|
import com.baidu.idl.face.main.finance.camera.AutoTexturePreviewView; |
||||
|
import com.baidu.idl.face.main.finance.camera.CameraPreviewManager; |
||||
|
import com.baidu.idl.face.main.finance.manager.FaceSDKManager; |
||||
|
import com.baidu.idl.face.main.finance.model.LivenessModel; |
||||
|
import com.baidu.idl.face.main.finance.model.SingleBaseConfig; |
||||
|
import com.baidu.idl.face.main.finance.utils.BitmapUtils; |
||||
|
import com.baidu.idl.face.main.finance.utils.FaceOnDrawTexturViewUtil; |
||||
|
import com.baidu.idl.face.main.finance.utils.TestPopWindow; |
||||
|
import com.baidu.idl.main.facesdk.FaceInfo; |
||||
|
import com.baidu.idl.main.facesdk.model.BDFaceImageInstance; |
||||
|
import com.ouxuan.oxface.utils.LogManager; |
||||
|
|
||||
|
/** |
||||
|
* 简化版人脸识别界面 - 只显示视频流 |
||||
|
*/ |
||||
|
public class OXFaceOnlineActivity extends BaseActivity implements View.OnClickListener { |
||||
|
|
||||
|
private static final float MIN_FACE_AREA = 1500; //人脸靠近阈值: 人脸面积在屏幕中的像素乘积 |
||||
|
private static final String TAG = "OXFaceOnlineActivity"; |
||||
|
private static final int CAMERA_PERMISSION_REQUEST_CODE = 1001; |
||||
|
|
||||
|
// 图片越大,性能消耗越大,也可以选择640*480, 1280*720 |
||||
|
private static final int PREFER_WIDTH = SingleBaseConfig.getBaseConfig().getRgbAndNirWidth(); |
||||
|
private static final int PERFER_HEIGH = SingleBaseConfig.getBaseConfig().getRgbAndNirHeight(); |
||||
|
private Context mContext; |
||||
|
private AutoTexturePreviewView mAutoCameraPreviewView; |
||||
|
private TextureView mDrawDetectFaceView; |
||||
|
private RelativeLayout relativeLayout; |
||||
|
private boolean isNeedCamera = true; |
||||
|
private RectF rectF; |
||||
|
private Paint paint; |
||||
|
private Paint paintBg; |
||||
|
private boolean liveStatus; |
||||
|
private LivenessModel currentLivenessModel; |
||||
|
|
||||
|
// 新增的视图元素 |
||||
|
private TextView preText; |
||||
|
private ImageView previewView; |
||||
|
private RelativeLayout preViewRelativeLayout; |
||||
|
|
||||
|
private TextView deveLop; |
||||
|
private RelativeLayout deveLopRelativeLayout; |
||||
|
private ImageView developView; |
||||
|
private TextView preToastText; |
||||
|
private TextView detectSurfaceText; |
||||
|
private ImageView isCheckImage; |
||||
|
private ImageView mFaceDetectImageView; |
||||
|
private TextView mTvDetect; |
||||
|
private TextView mTvLive; |
||||
|
private TextView mTvLiveScore; |
||||
|
private TextView mTvAllTime; |
||||
|
private RelativeLayout progressLayout; |
||||
|
private RelativeLayout layoutCompareStatus; |
||||
|
private TextView textCompareStatus; |
||||
|
private ImageView progressBarView; |
||||
|
private RelativeLayout payHintRl; |
||||
|
private boolean mIsPayHint = true; |
||||
|
private boolean count = true; |
||||
|
private RelativeLayout financeQualityTestFailed; |
||||
|
private TextView qualityTestTimeTv; |
||||
|
private TextView qualityDetectedTv; |
||||
|
private TextView qualityShelteredPart; |
||||
|
private Button qualityRetestDetectBtn; |
||||
|
private RelativeLayout financeByLivingDetection; |
||||
|
private RelativeLayout financeFailedInVivoTest; |
||||
|
private TextView failedInVivoTestRgb; |
||||
|
private TextView failedInVivoTestNir; |
||||
|
private TextView failedInVivoTestDepth; |
||||
|
private TextView failedInVivoTestTime; |
||||
|
private TextView failedInVivoTestFrames; |
||||
|
private TextView byLivingDetectionRgb; |
||||
|
private TextView byLivingDetectionNir; |
||||
|
private TextView byLivingDetectionDepth; |
||||
|
private TextView byLivingTetectionTime; |
||||
|
private TextView byLivingDetectionFrames; |
||||
|
private ImageView qualityDetectRegImageItem; |
||||
|
private ImageView noDetectRegImageItem; |
||||
|
private ImageView detectRegImageItem; |
||||
|
private TestPopWindow testPopWindow; |
||||
|
private View saveCamera; |
||||
|
private boolean isSaveImage; |
||||
|
private View spot; |
||||
|
private boolean isCheck = false; |
||||
|
private boolean isTime = true; |
||||
|
private long searshTime; |
||||
|
private boolean isCompareCheck = false; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.activity_oxface_online); |
||||
|
|
||||
|
mContext = this; |
||||
|
initView(); |
||||
|
|
||||
|
// 检查并请求相机权限 |
||||
|
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) |
||||
|
!= PackageManager.PERMISSION_GRANTED) { |
||||
|
ActivityCompat.requestPermissions(this, |
||||
|
new String[]{android.Manifest.permission.CAMERA}, |
||||
|
CAMERA_PERMISSION_REQUEST_CODE); |
||||
|
} else { |
||||
|
LogManager.logInfo(TAG, "相机权限已授予"); |
||||
|
} |
||||
|
|
||||
|
LogManager.logInfo(TAG, "OXFaceOnlineActivity onCreate"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* View |
||||
|
*/ |
||||
|
private void initView() { |
||||
|
LogManager.logInfo(TAG, "初始化界面视图"); |
||||
|
// 获取整个布局 |
||||
|
relativeLayout = findViewById(R.id.all_relative); |
||||
|
|
||||
|
// 单目摄像头RGB 图像预览 |
||||
|
mAutoCameraPreviewView = findViewById(R.id.auto_camera_preview_view); |
||||
|
// 画人脸框 |
||||
|
rectF = new RectF(); |
||||
|
paint = new Paint(); |
||||
|
paintBg = new Paint(); |
||||
|
mDrawDetectFaceView = findViewById(R.id.draw_detect_face_view); |
||||
|
mDrawDetectFaceView.setOpaque(false); |
||||
|
mDrawDetectFaceView.setKeepScreenOn(true); |
||||
|
|
||||
|
LogManager.logInfo(TAG, "镜像设置getRgbRevert"+SingleBaseConfig.getBaseConfig().getRgbRevert()); |
||||
|
|
||||
|
//TODO 还需要根据实际情况继续调整摄像头镜像参数 |
||||
|
android.util.Log.d( "OXFaceOnlineActivity", ": 666666" + SingleBaseConfig.getBaseConfig().getRgbRevert()); |
||||
|
if (SingleBaseConfig.getBaseConfig().getRgbRevert()){ |
||||
|
mDrawDetectFaceView.setRotationY(180); |
||||
|
}else{ |
||||
|
// mDrawDetectFaceView.setRotationY(0); |
||||
|
} |
||||
|
|
||||
|
// 返回 |
||||
|
ImageView mButReturn = findViewById(R.id.btn_back); |
||||
|
mButReturn.setOnClickListener(this); |
||||
|
|
||||
|
// ***************预览模式************* |
||||
|
// 导航栏 |
||||
|
// preText = findViewById(R.id.preview_text); |
||||
|
// if (preText != null) { |
||||
|
// preText.setOnClickListener(this); |
||||
|
// preText.setTextColor(Color.parseColor("#ffffff")); |
||||
|
// } |
||||
|
// previewView = findViewById(R.id.preview_view); |
||||
|
// 信息展示 |
||||
|
preViewRelativeLayout = findViewById(R.id.yvlan_relativeLayout); |
||||
|
preToastText = findViewById(R.id.pre_toast_text); |
||||
|
progressLayout = findViewById(R.id.progress_layout); |
||||
|
progressBarView = findViewById(R.id.progress_bar_view); |
||||
|
// 隐藏圆形进度条 |
||||
|
if (progressLayout != null) { |
||||
|
progressLayout.setVisibility(View.GONE); |
||||
|
} |
||||
|
// 预览模式下提示 |
||||
|
payHintRl = findViewById(R.id.pay_hintRl); |
||||
|
|
||||
|
// ***************开发模式************* |
||||
|
// 导航栏 |
||||
|
// deveLop = findViewById(R.id.develop_text); |
||||
|
// if (deveLop != null) { |
||||
|
// deveLop.setOnClickListener(this); |
||||
|
// deveLop.setTextColor(Color.parseColor("#a9a9a9")); |
||||
|
// } |
||||
|
// developView = findViewById(R.id.develop_view); |
||||
|
// if (developView != null) { |
||||
|
// developView.setVisibility(View.GONE); |
||||
|
// } |
||||
|
// 信息展示 |
||||
|
// deveLopRelativeLayout = findViewById(R.id.kaifa_relativeLayout); |
||||
|
// isCheckImage = findViewById(R.id.is_check_image); |
||||
|
// detectSurfaceText = findViewById(R.id.detect_surface_text); |
||||
|
// if (detectSurfaceText != null) { |
||||
|
// detectSurfaceText.setVisibility(View.GONE); |
||||
|
// } |
||||
|
// 送检RGB 图像回显 |
||||
|
// mFaceDetectImageView = findViewById(R.id.face_detect_image_view); |
||||
|
// if (mFaceDetectImageView != null) { |
||||
|
// mFaceDetectImageView.setVisibility(View.GONE); |
||||
|
// } |
||||
|
// 检测耗时 |
||||
|
// mTvDetect = findViewById(R.id.tv_detect_time); |
||||
|
// RGB活体 |
||||
|
// mTvLive = findViewById(R.id.tv_rgb_live_time); |
||||
|
// mTvLiveScore = findViewById(R.id.tv_rgb_live_score); |
||||
|
// 总耗时 |
||||
|
// mTvAllTime = findViewById(R.id.tv_all_time); |
||||
|
layoutCompareStatus = findViewById(R.id.layout_compare_status); |
||||
|
if (layoutCompareStatus != null) { |
||||
|
layoutCompareStatus.setVisibility(View.GONE); |
||||
|
} |
||||
|
textCompareStatus = findViewById(R.id.text_compare_status); |
||||
|
// 存图按钮 |
||||
|
saveCamera = findViewById(R.id.save_camera); |
||||
|
if (saveCamera != null) { |
||||
|
saveCamera.setOnClickListener(this); |
||||
|
saveCamera.setVisibility(View.GONE); |
||||
|
} |
||||
|
spot = findViewById(R.id.spot); |
||||
|
|
||||
|
// 质量检测未通过 |
||||
|
financeQualityTestFailed = findViewById(R.id.finance_quality_test_failed); |
||||
|
qualityTestTimeTv = findViewById(R.id.quality_test_timeTv); |
||||
|
qualityDetectedTv = findViewById(R.id.quality_detectedTv); |
||||
|
qualityShelteredPart = findViewById(R.id.quality_sheltered_part); |
||||
|
qualityRetestDetectBtn = findViewById(R.id.quality_retest_detectBtn); |
||||
|
if (qualityRetestDetectBtn != null) { |
||||
|
qualityRetestDetectBtn.setOnClickListener(this); |
||||
|
} |
||||
|
|
||||
|
// 活体通过 |
||||
|
financeByLivingDetection = findViewById(R.id.finance_by_living_detection); |
||||
|
byLivingDetectionRgb = findViewById(R.id.by_living_detection_rgb); |
||||
|
byLivingDetectionNir = findViewById(R.id.by_living_detection_nir); |
||||
|
byLivingDetectionDepth = findViewById(R.id.by_living_detection_depth); |
||||
|
byLivingTetectionTime = findViewById(R.id.by_living_detection_time); |
||||
|
byLivingDetectionFrames = findViewById(R.id.by_living_detection_Frames); |
||||
|
Button byLivingDetectionBtn = findViewById(R.id.by_living_detection_btn); |
||||
|
if (byLivingDetectionBtn != null) { |
||||
|
byLivingDetectionBtn.setOnClickListener(this); |
||||
|
} |
||||
|
detectRegImageItem = findViewById(R.id.detect_reg_image_item); |
||||
|
|
||||
|
// 活体未通过 |
||||
|
financeFailedInVivoTest = findViewById(R.id.finance_failed_in_vivo_test); |
||||
|
failedInVivoTestRgb = findViewById(R.id.failed_in_vivo_test_rgb); |
||||
|
failedInVivoTestNir = findViewById(R.id.failed_in_vivo_test_nir); |
||||
|
failedInVivoTestDepth = findViewById(R.id.failed_in_vivo_test_depth); |
||||
|
failedInVivoTestTime = findViewById(R.id.failed_in_vivo_test_time); |
||||
|
failedInVivoTestFrames = findViewById(R.id.failed_in_vivo_test_Frames); |
||||
|
Button failed_in_vivo_testBtn = findViewById(R.id.failed_in_vivo_testBtn); |
||||
|
if (failed_in_vivo_testBtn != null) { |
||||
|
failed_in_vivo_testBtn.setOnClickListener(this); |
||||
|
} |
||||
|
noDetectRegImageItem = findViewById(R.id.no_detect_reg_image_item); |
||||
|
|
||||
|
testPopWindow = new TestPopWindow(this, |
||||
|
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); |
||||
|
testPopWindow.setmOnClickFinance(new TestPopWindow.OnClickFinance() { |
||||
|
@Override |
||||
|
public void rester(boolean isReTest) { |
||||
|
// 重新检测 |
||||
|
if (isReTest) { |
||||
|
if (testPopWindow != null) { |
||||
|
testPopWindow.closePopupWindow(); |
||||
|
} |
||||
|
if (payHintRl != null) { |
||||
|
payHintRl.setVisibility(View.GONE); |
||||
|
} |
||||
|
count = true; |
||||
|
new Handler().postDelayed(new Runnable() { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
if (count) { |
||||
|
isNeedCamera = true; |
||||
|
} |
||||
|
} |
||||
|
}, 500); // 延迟0.5秒执行 |
||||
|
} else { |
||||
|
if (testPopWindow != null) { |
||||
|
testPopWindow.closePopupWindow(); |
||||
|
} |
||||
|
finish(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onResume() { |
||||
|
super.onResume(); |
||||
|
// 只有在拥有相机权限时才启动预览 |
||||
|
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) |
||||
|
== PackageManager.PERMISSION_GRANTED) { |
||||
|
startTestOpenDebugRegisterFunction(); |
||||
|
} |
||||
|
LogManager.logInfo(TAG, "OXFaceOnlineActivity onResume"); |
||||
|
} |
||||
|
|
||||
|
private void startTestOpenDebugRegisterFunction() { |
||||
|
LogManager.logInfo(TAG, "启动摄像头预览"); |
||||
|
// 设置摄像头方向 |
||||
|
if (SingleBaseConfig.getBaseConfig().getRBGCameraId() != -1){ |
||||
|
CameraPreviewManager.getInstance().setCameraFacing(SingleBaseConfig.getBaseConfig().getRBGCameraId()); |
||||
|
} else { |
||||
|
CameraPreviewManager.getInstance().setCameraFacing(CameraPreviewManager.CAMERA_FACING_FRONT); |
||||
|
} |
||||
|
|
||||
|
CameraPreviewManager.getInstance().startPreview(mContext, mAutoCameraPreviewView, |
||||
|
PREFER_WIDTH, PERFER_HEIGH, new CameraDataCallback() { |
||||
|
@Override |
||||
|
public void onGetCameraData(byte[] data, Camera camera, int width, int height) { |
||||
|
// 摄像头预览数据进行人脸检测 |
||||
|
if (isNeedCamera) { |
||||
|
FaceSDKManager.getInstance().onDetectCheck(data, null, null, |
||||
|
height, width, 1, new FaceDetectCallBack() { |
||||
|
@Override |
||||
|
public void onFaceDetectCallback(LivenessModel livenessModel) { |
||||
|
// 开发模式结果输出 |
||||
|
checkOpenDebugResult(livenessModel); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onTip(int code, String msg) { |
||||
|
LogManager.logInfo(TAG, "人脸检测提示 - 代码: " + code + ", 消息: " + msg); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFaceDetectDarwCallback(LivenessModel livenessModel) { |
||||
|
// 绘制人脸框 |
||||
|
showFrame(livenessModel); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 绘制人脸框 |
||||
|
*/ |
||||
|
private void showFrame(final LivenessModel model) { |
||||
|
runOnUiThread(new Runnable() { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
Canvas canvas = mDrawDetectFaceView.lockCanvas(); |
||||
|
if (canvas == null) { |
||||
|
mDrawDetectFaceView.unlockCanvasAndPost(canvas); |
||||
|
return; |
||||
|
} |
||||
|
if (model == null) { |
||||
|
// 清空canvas |
||||
|
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); |
||||
|
mDrawDetectFaceView.unlockCanvasAndPost(canvas); |
||||
|
return; |
||||
|
} |
||||
|
FaceInfo[] faceInfos = model.getTrackFaceInfo(); |
||||
|
|
||||
|
if (faceInfos == null || faceInfos.length == 0) { |
||||
|
// 清空canvas |
||||
|
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); |
||||
|
mDrawDetectFaceView.unlockCanvasAndPost(canvas); |
||||
|
return; |
||||
|
} |
||||
|
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); |
||||
|
for (int i = 0 ; i < faceInfos.length;i++) { |
||||
|
FaceInfo faceInfo = faceInfos[i]; |
||||
|
|
||||
|
rectF.set(FaceOnDrawTexturViewUtil.getFaceRectTwo(faceInfo)); |
||||
|
// 检测图片的坐标和显示的坐标不一样,需要转换。 |
||||
|
FaceOnDrawTexturViewUtil.mapFromOriginalRect(rectF, |
||||
|
mAutoCameraPreviewView, model.getBdFaceImageInstance()); |
||||
|
// 人脸框颜色 |
||||
|
FaceOnDrawTexturViewUtil.drawFaceColor(paint, paintBg, liveStatus, model); |
||||
|
// 绘制人脸框 |
||||
|
FaceOnDrawTexturViewUtil.drawRect(canvas, |
||||
|
rectF, paint, 5f, 50f, 25f); |
||||
|
} |
||||
|
// 清空canvas |
||||
|
mDrawDetectFaceView.unlockCanvasAndPost(canvas); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
int id = view.getId(); |
||||
|
if (id == R.id.btn_back) { |
||||
|
finish(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { |
||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
||||
|
if (requestCode == CAMERA_PERMISSION_REQUEST_CODE) { |
||||
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
||||
|
LogManager.logInfo(TAG, "相机权限已授予,启动摄像头预览"); |
||||
|
startTestOpenDebugRegisterFunction(); |
||||
|
} else { |
||||
|
LogManager.logError(TAG, "相机权限被拒绝"); |
||||
|
Toast.makeText(this, "需要相机权限才能使用人脸识别功能", Toast.LENGTH_LONG).show(); |
||||
|
finish(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onDestroy() { |
||||
|
super.onDestroy(); |
||||
|
LogManager.logInfo(TAG, "OXFaceOnlineActivity onDestroy"); |
||||
|
} |
||||
|
|
||||
|
// ***************开发模式结果输出************* |
||||
|
private void checkOpenDebugResult(final LivenessModel livenessModel) { |
||||
|
// 当未检测到人脸UI显示 |
||||
|
runOnUiThread(new Runnable() { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
layoutCompareStatus.setBackgroundColor(Color.parseColor("#CC000000")); |
||||
|
if (livenessModel == null) { |
||||
|
liveStatus = false; |
||||
|
layoutCompareStatus.setVisibility(View.GONE); |
||||
|
// mFaceDetectImageView.setImageResource(R.mipmap.ic_image_video); |
||||
|
// mTvDetect.setText(String.format("检测耗时 :%s ms", 0)); |
||||
|
// mTvLive.setText(String.format("RGB活体检测耗时 :%s ms", 0)); |
||||
|
// mTvLiveScore.setText(String.format("RGB活体检测结果 :%s", false)); |
||||
|
// mTvAllTime.setText(String.format("总耗时 :%s ms", 0)); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
BDFaceImageInstance image = livenessModel.getBdFaceImageInstance(); |
||||
|
if (image != null) { |
||||
|
// mFaceDetectImageView.setImageBitmap(BitmapUtils.getInstaceBmp(image)); |
||||
|
float faceArea = livenessModel.getFaceInfo().width * livenessModel.getFaceInfo().height; |
||||
|
image.destory(); |
||||
|
|
||||
|
// 新增:人脸过小检测 |
||||
|
if (faceArea < MIN_FACE_AREA) { |
||||
|
layoutCompareStatus.setVisibility(View.VISIBLE); |
||||
|
textCompareStatus.setTextColor(Color.parseColor("#fec133")); |
||||
|
textCompareStatus.setText("请靠近设备"); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 模糊结果过滤 |
||||
|
float blur = livenessModel.getFaceInfo().bluriness; |
||||
|
if (blur > SingleBaseConfig.getBaseConfig().getBlur()) { |
||||
|
//照片模糊 |
||||
|
layoutCompareStatus.setVisibility(View.VISIBLE); |
||||
|
textCompareStatus.setTextColor(Color.parseColor("#fec133")); |
||||
|
textCompareStatus.setText("人脸模糊,请靠近"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
//质量检测 |
||||
|
if (!livenessModel.isQualityCheck()) { |
||||
|
liveStatus = false; |
||||
|
} else { |
||||
|
// 活体检测逻辑 |
||||
|
if (SingleBaseConfig.getBaseConfig().isLivingControl()) { |
||||
|
if (livenessModel.isRGBLiveStatus()) { |
||||
|
liveStatus = true; |
||||
|
layoutCompareStatus.setVisibility(View.VISIBLE); |
||||
|
textCompareStatus.setTextColor(Color.parseColor("#009874")); |
||||
|
textCompareStatus.setText("通过活体检测"); |
||||
|
} else { |
||||
|
liveStatus = false; |
||||
|
layoutCompareStatus.setVisibility(View.VISIBLE); |
||||
|
textCompareStatus.setTextColor(Color.parseColor("#fec133")); |
||||
|
textCompareStatus.setText("未通过活体检测"); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
FaceInfo faceInfo = livenessModel.getFaceInfo(); |
||||
|
if (faceInfo.bestImageScore < SingleBaseConfig.getBaseConfig().getBestImageScore()) { |
||||
|
layoutCompareStatus.setVisibility(View.VISIBLE); |
||||
|
textCompareStatus.setTextColor(Color.parseColor("#fec133")); |
||||
|
textCompareStatus.setText("阈值低于" + SingleBaseConfig.getBaseConfig().getBestImageScore()); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
//通过检测 |
||||
|
if (livenessModel != null) { |
||||
|
checkResultOnline(livenessModel);//在线人脸检测 |
||||
|
} else { |
||||
|
currentLivenessModel = null; |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void checkResultOnline(LivenessModel livenessModel) { |
||||
|
this.currentLivenessModel = livenessModel; |
||||
|
// 当未检测到人脸UI显示 |
||||
|
runOnUiThread(new Runnable() { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
if (livenessModel == null) { |
||||
|
return; |
||||
|
} |
||||
|
String base64img = getFaceImageBase64(currentLivenessModel); |
||||
|
|
||||
|
if (base64img != null) { |
||||
|
// Log.i(TAG, "checkResultOnline: " + base64img); |
||||
|
Log.i(TAG, "checkResultOnline: Yes! Got a base64img!" ); |
||||
|
} else { |
||||
|
Log.i(TAG, "run:checkResultOnline base64img score too low "); |
||||
|
layoutCompareStatus.setVisibility(View.VISIBLE); |
||||
|
textCompareStatus.setTextColor(Color.parseColor("#fec133")); |
||||
|
textCompareStatus.setText("请重新识别"); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private String getFaceImageBase64(LivenessModel livenessModel) { |
||||
|
if (livenessModel == null) return null; |
||||
|
FaceInfo faceInfo = livenessModel.getFaceInfo(); |
||||
|
|
||||
|
if (true) { //判定条件 |
||||
|
BDFaceImageInstance image = livenessModel.getBdFaceImageInstance(); |
||||
|
Bitmap bitmap = BitmapUtils.getInstaceBmp(image); |
||||
|
|
||||
|
String bitmap_str = BitmapUtils.bitmapToBase64(bitmap); |
||||
|
image.destory(); |
||||
|
return bitmap_str; // 简化实现,实际项目中需要实现 bitmap 转 base64 的功能 |
||||
|
} else { |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:shape="rectangle"> |
||||
|
|
||||
|
<!-- 填充的颜色 --> |
||||
|
<solid android:color="#CC000000" /> |
||||
|
|
||||
|
<!-- 设置按钮的四个角为弧形 --> |
||||
|
<!-- android:radius 弧形的半径 --> |
||||
|
<corners android:radius="0dp" /> |
||||
|
|
||||
|
</shape> |
@ -0,0 +1,5 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
|
<!-- 设置按钮的四个角为弧形 --> |
||||
|
<corners android:radius="5dp" /> |
||||
|
</shape> |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:shape="rectangle"> |
||||
|
|
||||
|
<!-- 填充的颜色 --> |
||||
|
<solid android:color="#CC000000" /> |
||||
|
<!-- <solid android:color="#CCFFFFFF" />--> |
||||
|
|
||||
|
<!-- 设置按钮的四个角为弧形 --> |
||||
|
<!-- android:radius 弧形的半径 --> |
||||
|
<corners android:radius="8dp" /> |
||||
|
|
||||
|
</shape> |
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
|
<!-- 填充的颜色 --> |
||||
|
<solid android:color="#F34B60" /> |
||||
|
|
||||
|
|
||||
|
<!-- 设置按钮的四个角为弧形 --> |
||||
|
<corners |
||||
|
android:radius="6dp" /> |
||||
|
</shape> |
@ -0,0 +1,219 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:id="@+id/all_relative" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:background="#000000"> |
||||
|
|
||||
|
<!-- 摄像头预览区域 --> |
||||
|
<com.baidu.idl.face.main.finance.camera.AutoTexturePreviewView |
||||
|
android:id="@+id/auto_camera_preview_view" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:background="#000000" /> |
||||
|
|
||||
|
<!-- 人脸框绘制区域 --> |
||||
|
<TextureView |
||||
|
android:id="@+id/draw_detect_face_view" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" /> |
||||
|
|
||||
|
<!-- 圆形进度条 --> |
||||
|
<RelativeLayout |
||||
|
android:id="@+id/progress_layout" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent"> |
||||
|
|
||||
|
<ImageView |
||||
|
android:id="@+id/progress_bar_view" |
||||
|
android:layout_width="355dp" |
||||
|
android:layout_height="355dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_centerVertical="true" |
||||
|
android:src="@mipmap/ic_loading_grey" /> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<!-- 提示文本 --> |
||||
|
<TextView |
||||
|
android:id="@+id/pre_toast_text" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_marginTop="100dp" |
||||
|
android:gravity="center_horizontal" |
||||
|
android:text="请保持面部在取景框内" |
||||
|
android:textColor="#ffffff" |
||||
|
android:textSize="22sp" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<!-- 信息展示部分 --> |
||||
|
<RelativeLayout |
||||
|
android:id="@+id/yvlan_relativeLayout" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="127dp" |
||||
|
android:layout_alignParentBottom="true" |
||||
|
android:layout_marginLeft="10dp" |
||||
|
android:layout_marginRight="10dp" |
||||
|
android:layout_marginBottom="5dp" |
||||
|
android:background="@drawable/finance_radius" |
||||
|
android:orientation="horizontal" |
||||
|
android:visibility="gone"> |
||||
|
|
||||
|
<include layout="@layout/layout_hint" |
||||
|
android:id="@+id/pay_hintRl" /> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<!-- 开发模式信息展示 --> |
||||
|
<RelativeLayout |
||||
|
android:id="@+id/kaifa_relativeLayout" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="127dp" |
||||
|
android:layout_alignParentBottom="true" |
||||
|
android:layout_marginLeft="10dp" |
||||
|
android:layout_marginRight="10dp" |
||||
|
android:layout_marginBottom="5dp" |
||||
|
android:background="@drawable/finance_radius" |
||||
|
android:orientation="horizontal" |
||||
|
android:visibility="gone"> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_marginTop="15dp"> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginLeft="20dp" |
||||
|
android:orientation="vertical"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/tv_detect_time" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:text="检测耗时:" |
||||
|
android:textColor="#ffffff" |
||||
|
android:textSize="12sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/tv_rgb_live_time" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="5dp" |
||||
|
android:text="RGB活体检测耗时:" |
||||
|
android:textColor="#ffffff" |
||||
|
android:textSize="12sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/tv_rgb_live_score" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="5dp" |
||||
|
android:text="RGB活体检测结果:" |
||||
|
android:textColor="#ffffff" |
||||
|
android:textSize="12sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/tv_all_time" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="5dp" |
||||
|
android:text="总耗时:" |
||||
|
android:textColor="#ffffff" |
||||
|
android:textSize="12sp" /> |
||||
|
</LinearLayout> |
||||
|
|
||||
|
<ImageView |
||||
|
android:id="@+id/face_detect_image_view" |
||||
|
android:layout_width="110dp" |
||||
|
android:layout_height="83dp" |
||||
|
android:layout_alignParentRight="true" |
||||
|
android:layout_centerVertical="true" |
||||
|
android:layout_marginRight="15dp" |
||||
|
android:background="@drawable/gate_imageview_radius" |
||||
|
android:src="@mipmap/ic_image_video" /> |
||||
|
|
||||
|
<!-- 存图相关视图 --> |
||||
|
<TextView |
||||
|
android:id="@+id/detect_surface_text" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_centerInParent="true" |
||||
|
android:text="检测表面" |
||||
|
android:textColor="#ffffff" |
||||
|
android:textSize="12sp" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<View |
||||
|
android:id="@+id/spot" |
||||
|
android:layout_width="10dp" |
||||
|
android:layout_height="10dp" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_alignParentRight="true" |
||||
|
android:layout_marginTop="10dp" |
||||
|
android:layout_marginRight="10dp" |
||||
|
android:background="@drawable/spot" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<ImageView |
||||
|
android:id="@+id/save_camera" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_alignParentBottom="true" |
||||
|
android:layout_alignParentRight="true" |
||||
|
android:layout_marginBottom="10dp" |
||||
|
android:layout_marginRight="10dp" |
||||
|
android:src="@mipmap/ic_save_camera" |
||||
|
android:visibility="gone" /> |
||||
|
</RelativeLayout> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<!-- 质量检测未通过 --> |
||||
|
<include layout="@layout/layout_quality_test_failed" |
||||
|
android:id="@+id/finance_quality_test_failed" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<!-- 活体检测未通过 --> |
||||
|
<include layout="@layout/layout_failed_in_vivo_test" |
||||
|
android:id="@+id/finance_failed_in_vivo_test" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<!-- 活体检测通过 --> |
||||
|
<include layout="@layout/layout_by_living_detection" |
||||
|
android:id="@+id/finance_by_living_detection" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<!-- 返回按钮 --> |
||||
|
<ImageView |
||||
|
android:id="@+id/btn_back" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_alignParentLeft="true" |
||||
|
android:layout_marginTop="20dp" |
||||
|
android:layout_marginLeft="20dp" |
||||
|
android:src="@mipmap/ic_finance_back" |
||||
|
android:visibility="visible" /> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:id="@+id/layout_compare_status" |
||||
|
android:layout_width="150dp" |
||||
|
android:layout_height="44dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_marginTop="50dp" |
||||
|
android:background="@drawable/gate_radius_compare" |
||||
|
android:visibility="gone"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/text_compare_status" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_centerVertical="true" |
||||
|
android:gravity="center" |
||||
|
android:textColor="#FF00BAF2" |
||||
|
android:textSize="20sp" /> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
</RelativeLayout> |
@ -0,0 +1,124 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_gravity="center" |
||||
|
android:background="@android:color/transparent"> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:id="@+id/quality_detectedRl" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content"> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:id="@+id/detect_reg_layout" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="80dp"> |
||||
|
|
||||
|
<com.baidu.idl.face.main.finance.view.CircleImageView |
||||
|
android:id="@+id/detect_reg_image_item" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_centerVertical="true" /> |
||||
|
|
||||
|
<ImageView |
||||
|
android:id="@+id/quality_no_detectIv" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_centerVertical="true" |
||||
|
android:background="@mipmap/ic_mask_success" /> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<ImageView |
||||
|
android:layout_width="@dimen/finance_47_dp" |
||||
|
android:layout_height="@dimen/finance_47_dp" |
||||
|
android:layout_alignEnd="@+id/detect_reg_layout" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_marginTop="65dp" |
||||
|
android:background="@mipmap/stars" |
||||
|
tools:ignore="RtlCompat" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/no_detectTv" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/detect_reg_layout" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="@dimen/finance_35_dp" |
||||
|
android:text="通过活体检测" |
||||
|
android:textColor="@color/finance_00BAF2" |
||||
|
android:textSize="33sp" /> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/no_detectTv" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="40dp"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/by_living_detection_rgb" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/by_living_detection_nir" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/by_living_detection_rgb" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/by_living_detection_depth" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/by_living_detection_nir" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/by_living_detection_time" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/by_living_detection_depth" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/by_living_detection_Frames" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/by_living_detection_time" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
</RelativeLayout> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<Button |
||||
|
android:id="@+id/by_living_detection_btn" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="66dp" |
||||
|
android:layout_alignParentBottom="true" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginLeft="74dp" |
||||
|
android:layout_marginBottom="100dp" |
||||
|
android:background="@drawable/button_selector" |
||||
|
android:text="重新检测" |
||||
|
android:textColor="@color/finance_white" |
||||
|
android:textSize="27sp" /> |
||||
|
|
||||
|
<include layout="@layout/layout_buttom" /> |
||||
|
</RelativeLayout> |
@ -0,0 +1,119 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_gravity="center" |
||||
|
android:background="@android:color/transparent"> |
||||
|
|
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:id="@+id/no_detect_reg_layout" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="80dp"> |
||||
|
|
||||
|
<com.baidu.idl.face.main.finance.view.CircleImageView |
||||
|
android:id="@+id/no_detect_reg_image_item" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_centerVertical="true" /> |
||||
|
|
||||
|
<ImageView |
||||
|
android:id="@+id/no_detectIv" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_centerVertical="true" |
||||
|
android:background="@mipmap/ic_mask_fail" /> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<ImageView |
||||
|
android:layout_width="@dimen/finance_47_dp" |
||||
|
android:layout_height="@dimen/finance_47_dp" |
||||
|
android:layout_alignEnd="@+id/no_detect_reg_layout" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_marginTop="65dp" |
||||
|
android:background="@mipmap/waterdrop" |
||||
|
tools:ignore="RtlCompat" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/no_detectTv" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/no_detect_reg_layout" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="@dimen/finance_35_dp" |
||||
|
android:text="未通过活体检测" |
||||
|
android:textColor="@color/finance_FFFECD33" |
||||
|
android:textSize="33sp" /> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/no_detectTv" |
||||
|
android:layout_marginTop="40dp"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/failed_in_vivo_test_rgb" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/failed_in_vivo_test_nir" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/failed_in_vivo_test_rgb" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/failed_in_vivo_test_depth" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/failed_in_vivo_test_nir" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/failed_in_vivo_test_time" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/failed_in_vivo_test_depth" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/failed_in_vivo_test_Frames" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/failed_in_vivo_test_time" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<Button |
||||
|
android:id="@+id/failed_in_vivo_testBtn" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="66dp" |
||||
|
android:layout_alignParentBottom="true" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginLeft="74dp" |
||||
|
android:layout_marginBottom="100dp" |
||||
|
android:background="@drawable/button_selector" |
||||
|
android:text="重新检测" |
||||
|
android:textColor="@color/finance_white" |
||||
|
android:textSize="27sp" /> |
||||
|
|
||||
|
<include layout="@layout/layout_buttom"/> |
||||
|
</RelativeLayout> |
@ -0,0 +1,37 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:id="@+id/pay_hintRl" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_gravity="top" |
||||
|
android:background="#121212" |
||||
|
android:visibility="visible"> |
||||
|
|
||||
|
|
||||
|
<!-- 质量检测未通过--> |
||||
|
<include |
||||
|
android:id="@+id/finance_quality_test_failed" |
||||
|
layout="@layout/layout_quality_test_failed" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_centerInParent="true" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<!-- 活体检测未通过--> |
||||
|
<include |
||||
|
android:id="@+id/finance_failed_in_vivo_test" |
||||
|
layout="@layout/layout_failed_in_vivo_test" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_centerInParent="true" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<!-- 活体检测通过--> |
||||
|
<include |
||||
|
android:id="@+id/finance_by_living_detection" |
||||
|
layout="@layout/layout_by_living_detection" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_centerInParent="true" |
||||
|
android:visibility="gone" /> |
||||
|
</RelativeLayout> |
@ -0,0 +1,70 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:clipChildren="false"> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:layout_marginBottom="80dp" |
||||
|
android:layout_marginTop="80dp" |
||||
|
android:layout_marginRight="@dimen/finance_50_dp" |
||||
|
android:layout_marginLeft="@dimen/finance_50_dp" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:background="@drawable/face_detected_round"> |
||||
|
|
||||
|
<ImageView |
||||
|
android:id="@+id/no_detectIv" |
||||
|
android:layout_width="@dimen/finance_108_dp" |
||||
|
android:layout_height="@dimen/finance_108_dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="80dp" |
||||
|
android:background="@mipmap/ic_mask_fail" /> |
||||
|
|
||||
|
<ImageView |
||||
|
android:layout_width="@dimen/finance_47_dp" |
||||
|
android:layout_height="@dimen/finance_47_dp" |
||||
|
android:layout_alignEnd="@+id/no_detectIv" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_marginTop="65dp" |
||||
|
android:background="@mipmap/waterdrop" |
||||
|
tools:ignore="RtlCompat" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/no_detectTv" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/no_detectIv" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="40dp" |
||||
|
android:text="未检测到人脸" |
||||
|
android:textColor="@color/finance_FFFECD33" |
||||
|
android:textSize="33sp" /> |
||||
|
|
||||
|
<Button |
||||
|
android:id="@+id/retest_detectBtn" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="60dp" |
||||
|
android:layout_below="@+id/no_detectTv" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="60dp" |
||||
|
android:background="@drawable/button_selector" |
||||
|
android:text="重新检测" |
||||
|
android:textColor="@color/finance_white" |
||||
|
android:textSize="27sp" /> |
||||
|
|
||||
|
<Button |
||||
|
android:id="@+id/back_homeBtn" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="60dp" |
||||
|
android:layout_below="@+id/retest_detectBtn" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="30dp" |
||||
|
android:layout_marginBottom="@dimen/finance_73_dp" |
||||
|
android:background="@drawable/button_selector_grey" |
||||
|
android:text="回到首页" |
||||
|
android:textColor="@color/finance_white" |
||||
|
android:textSize="27sp" /> |
||||
|
</RelativeLayout> |
||||
|
</RelativeLayout> |
@ -0,0 +1,108 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_gravity="center" |
||||
|
android:background="@android:color/transparent"> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:id="@+id/quality_detectedRl" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content"> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:id="@+id/detect_reg_layout" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="80dp"> |
||||
|
|
||||
|
<com.baidu.idl.face.main.finance.view.CircleImageView |
||||
|
android:id="@+id/quality_detect_reg_image_item" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_centerVertical="true" /> |
||||
|
|
||||
|
<ImageView |
||||
|
android:id="@+id/quality_no_detectIv" |
||||
|
android:layout_width="108dp" |
||||
|
android:layout_height="108dp" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_centerVertical="true" |
||||
|
android:background="@mipmap/ic_mask_fail" /> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<ImageView |
||||
|
android:layout_width="@dimen/finance_47_dp" |
||||
|
android:layout_height="@dimen/finance_47_dp" |
||||
|
android:layout_alignEnd="@+id/detect_reg_layout" |
||||
|
android:layout_alignParentTop="true" |
||||
|
android:layout_marginTop="65dp" |
||||
|
android:background="@mipmap/waterdrop" |
||||
|
tools:ignore="RtlCompat" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/no_detectTv" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/detect_reg_layout" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="@dimen/finance_35_dp" |
||||
|
android:text="未通过质量检测" |
||||
|
android:textColor="@color/finance_FFFECD33" |
||||
|
android:textSize="33sp" /> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/no_detectTv" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginTop="80dp"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/quality_test_timeTv" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/quality_detectedTv" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/quality_test_timeTv" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/quality_sheltered_part" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_below="@+id/quality_detectedTv" |
||||
|
android:layout_marginTop="@dimen/finance_10_dp" |
||||
|
android:textColor="@color/finance_FFCCCCCC" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
</RelativeLayout> |
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<Button |
||||
|
android:id="@+id/quality_retest_detectBtn" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="66dp" |
||||
|
android:layout_alignParentBottom="true" |
||||
|
android:layout_centerHorizontal="true" |
||||
|
android:layout_marginLeft="74dp" |
||||
|
android:layout_marginBottom="100dp" |
||||
|
android:background="@drawable/button_selector" |
||||
|
android:text="重新检测" |
||||
|
android:textColor="@color/finance_white" |
||||
|
android:textSize="27sp" /> |
||||
|
|
||||
|
<include layout="@layout/layout_buttom" /> |
||||
|
|
||||
|
</RelativeLayout> |
After Width: 66 | Height: 66 | Size: 1017 B |
After Width: 66 | Height: 66 | Size: 1.6 KiB |
After Width: 343 | Height: 342 | Size: 3.7 KiB |
After Width: 68 | Height: 68 | Size: 1.1 KiB |
After Width: 68 | Height: 68 | Size: 1.0 KiB |
After Width: 330 | Height: 248 | Size: 3.0 KiB |
After Width: 796 | Height: 796 | Size: 35 KiB |
After Width: 796 | Height: 796 | Size: 36 KiB |
After Width: 66 | Height: 66 | Size: 1017 B |
After Width: 66 | Height: 66 | Size: 1.6 KiB |
After Width: 343 | Height: 342 | Size: 3.7 KiB |
After Width: 68 | Height: 68 | Size: 1.1 KiB |
After Width: 68 | Height: 68 | Size: 1.0 KiB |
After Width: 330 | Height: 248 | Size: 3.0 KiB |
After Width: 796 | Height: 796 | Size: 35 KiB |
After Width: 796 | Height: 796 | Size: 36 KiB |