| | |
| | | } |
| | | |
| | | private static BDFaceImageInstance rgbInstance =null; |
| | | private LivenessModel livenessModel; |
| | | private String groupId; |
| | | |
| | | /** |
| | | * 0:管理员,1:用户 |
| | | * @param groupId |
| | | */ |
| | | public void setGroupId(String groupId){ |
| | | this.groupId = groupId; |
| | | } |
| | | /** |
| | | * 检测-活体-特征-人脸检索流程 |
| | | * |
| | |
| | | * @param faceDetectCallBack |
| | | */ |
| | | public void onDetectCheck( |
| | | String groupId, |
| | | final BDFaceImageConfig bdFaceImageConfig, |
| | | final BDFaceImageConfig bdNirFaceImageConfig, |
| | | final BDFaceImageConfig bdDepthFaceImageConfig, |
| | |
| | | } |
| | | long startTime = System.currentTimeMillis(); |
| | | // 创建检测结果存储数据 |
| | | LivenessModel livenessModel = new LivenessModel(); |
| | | livenessModel.setGroupId(groupId); |
| | | livenessModel = new LivenessModel(); |
| | | // 创建检测对象,如果原始数据YUV,转为算法检测的图片BGR |
| | | // TODO: 用户调整旋转角度和是否镜像,手机和开发版需要动态适配 |
| | | //System.out.println("==rgbInstance==>初始化"); |
| | |
| | | //System.out.println("==isOk==>匹配到数量"+featureResult.size()); |
| | | User user = null; |
| | | Feature topFeature = null; |
| | | if(TextUtils.isEmpty(livenessModel.getGroupId())){ |
| | | if(TextUtils.isEmpty(groupId)){ |
| | | //为空,需要排序,优先取会员 |
| | | for(Feature feat:featureResult) { |
| | | threholdScore = bdFaceCheckConfig.scoreThreshold; |
| | | if (feat != null && feat.getScore() > threholdScore) { |
| | | User userOld = FaceApi.getInstance().getUserListById(feat.getId()); |
| | | //System.out.println("==isOk==>匹配到类型:"+userOld.getUserName()); |
| | | if("0".equals(userOld.getGroupId())){ |
| | | if("1".equals(userOld.getGroupId())){ |
| | | user = userOld; |
| | | topFeature = feat; |
| | | break; |
| | |
| | | //System.out.println("==isOk==>50"); |
| | | // 当前featureEntity 只有id+feature 索引,在数据库中查到完整信息 |
| | | User userOld = FaceApi.getInstance().getUserListById(feat.getId()); |
| | | if(livenessModel.getGroupId().equals(userOld.getGroupId())){ |
| | | if(groupId.equals(userOld.getGroupId())){ |
| | | user = userOld; |
| | | topFeature = feat; |
| | | break; |