feat(face): 添加人脸识别距离检测和环境切换时的人脸数据重置功能
- 在FaceHelper中添加人脸宽度小于200像素时的过滤逻辑,避免远距离识别人脸 - 注释掉LoginByFaceActivity中的重复识别状态判断逻辑 - 在PlcSettingActivity中添加协程支持用于异步处理人脸数据清除操作 - 实现环境切换时清空所有人脸数据并重新获取用户人脸缓存的功能 - 修改UserViewModel中回调逻辑,当第一页无数据时返回false而非true
This commit is contained in:
@@ -772,13 +772,13 @@ class LoginByFaceActivity : BaseActivity<ActivityLoginFaceBinding>(),
|
||||
lifecycleScope = lifecycleScope,
|
||||
onTick = { remaining ->
|
||||
loadLogInfo("resetRecognizeState剩余时间:$remaining 秒")
|
||||
if (judgeRecognizeState()) return@startCountDown
|
||||
// if (judgeRecognizeState()) return@startCountDown
|
||||
loadLogInfo("initCountTime onTick = $remaining")
|
||||
binding.tvToInit.text = "$remaining"
|
||||
},
|
||||
onFinish = {
|
||||
loadLogInfo("resetRecognizeState倒计时结束")
|
||||
if (judgeRecognizeState()) return@startCountDown
|
||||
// if (judgeRecognizeState()) return@startCountDown
|
||||
if (facePreviewInfoList.isNullOrEmpty()) {
|
||||
goInitActivity()
|
||||
} else {
|
||||
@@ -802,20 +802,20 @@ class LoginByFaceActivity : BaseActivity<ActivityLoginFaceBinding>(),
|
||||
// recognizeViewModel.onPreviewFrame(emptyFrame, true)
|
||||
}
|
||||
|
||||
private fun judgeRecognizeState(): Boolean {
|
||||
val rectColor = binding.dualCameraFaceRectView.rectColor
|
||||
if (rectColor == RecognizeColor.COLOR_SUCCESS && currentUserId.isNullOrBlank()
|
||||
.not() && facePreviewInfoList.isNullOrEmpty().not()
|
||||
) {
|
||||
//人未离开,再次识别
|
||||
loadLogInfo("userId=$currentUserId")
|
||||
openPlateDebouncer.debounce {
|
||||
openPlate(currentUserId)
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
// private fun judgeRecognizeState(): Boolean {
|
||||
// val rectColor = binding.dualCameraFaceRectView.rectColor
|
||||
// if (rectColor == RecognizeColor.COLOR_SUCCESS && currentUserId.isNullOrBlank()
|
||||
// .not() && facePreviewInfoList.isNullOrEmpty().not()
|
||||
// ) {
|
||||
// //人未离开,再次识别
|
||||
// loadLogInfo("userId=$currentUserId")
|
||||
// openPlateDebouncer.debounce {
|
||||
// openPlate(currentUserId)
|
||||
// }
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
|
||||
fun goInitActivity() {
|
||||
val intent = Intent(context, InitActivity::class.java)
|
||||
|
||||
Reference in New Issue
Block a user