|
@@ -121,7 +121,20 @@ public class ExamFaceLivenessVerifyServiceImpl implements ExamFaceLivenessVerify
|
|
|
if (confidence > 50D) {
|
|
|
JSONObject livenessResultJson = faceIdResultJsonObject.getJSONObject("liveness_result");
|
|
|
if (livenessResultJson.has("result") && "success".equals(livenessResultJson.getString("result"))) {
|
|
|
- faceVerify.setVerifyResult(FaceVerifyResult.VERIFY_SUCCESS);
|
|
|
+ JSONObject faceGenuineness = verifyResultJson.getJSONObject("face_genuineness");
|
|
|
+ //如果开启了翻拍检测
|
|
|
+ if(faceGenuineness.has("screen_replay_threshold") && faceGenuineness.has("screen_replay_confidence")){
|
|
|
+ double replayThreshold = faceGenuineness.getDouble("screen_replay_threshold");
|
|
|
+ double replayConfidence = faceGenuineness.getDouble("screen_replay_confidence");
|
|
|
+ //如果大于阈值,表明为翻拍
|
|
|
+ if (replayConfidence >= replayThreshold) {
|
|
|
+ faceVerify.setVerifyResult(FaceVerifyResult.SCREEN_REPLAY);
|
|
|
+ } else {
|
|
|
+ faceVerify.setVerifyResult(FaceVerifyResult.VERIFY_SUCCESS);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ faceVerify.setVerifyResult(FaceVerifyResult.VERIFY_SUCCESS);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
faceVerify.setVerifyResult(FaceVerifyResult.NOT_ONESELF);
|
|
@@ -261,6 +274,16 @@ public class ExamFaceLivenessVerifyServiceImpl implements ExamFaceLivenessVerify
|
|
|
multipartEntityBuilder.addTextBody("biz_no", bizNo);
|
|
|
multipartEntityBuilder.addTextBody("uuid", bizNo);
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * screen_replay表示是否开启屏幕翻拍检测。
|
|
|
+ *
|
|
|
+ * 0:默认值,不开启屏幕翻拍的检测;
|
|
|
+ * 1:开启屏幕翻拍检测(若检测屏幕翻拍,返回值将增加屏幕翻拍的结果返回)
|
|
|
+ * 注:由于PC端的某些摄像头的驱动,自带增加摄像头视频特效等功能。开启屏幕翻拍检测之后,有可能导致误检增加。
|
|
|
+ */
|
|
|
+ multipartEntityBuilder.addTextBody("screen_replay","1");
|
|
|
+
|
|
|
multipartEntityBuilder.addBinaryBody("image_ref1", basePhotoFile);
|
|
|
return multipartEntityBuilder;
|
|
|
}
|