face_config.dart 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import 'face_environment.dart';
  2. import 'liveness_type_enum.dart';
  3. class FaceConfig {
  4. /// 图像光照阀值
  5. var brightnessValue = FaceEnvironment.VALUE_BRIGHTNESS;
  6. /// 图像模糊阀值
  7. var blurnessValue = FaceEnvironment.VALUE_BLURNESS;
  8. /// 图像中人脸遮挡阀值
  9. var occlusionValue = FaceEnvironment.VALUE_OCCLUSION;
  10. /// 图像中人脸抬头低头角度阀值
  11. var headPitchValue = FaceEnvironment.VALUE_HEAD_PITCH;
  12. /// 图像中人脸左右角度阀值
  13. var headYawValue = FaceEnvironment.VALUE_HEAD_YAW;
  14. /// 图像中人脸偏头阀值
  15. var headRollValue = FaceEnvironment.VALUE_HEAD_ROLL;
  16. /// 抠图高的设定,为了保证好的抠图效果,我们要求高宽比是4:3,所以会在内部进行计算,只需要传入高即可
  17. var cropHeight = FaceEnvironment.VALUE_CROP_HEIGHT;
  18. /// 图像能被检测出人脸的最小人脸值
  19. var minFaceSize = FaceEnvironment.VALUE_MIN_FACE_SIZE;
  20. /// 图像能被检测出人脸阀值
  21. var notFaceValue = FaceEnvironment.VALUE_NOT_FACE_THRESHOLD;
  22. /// 是否开启提示音
  23. var isSound = true;
  24. /// 是否随机活体检测动作
  25. var isLivenessRandom = false;
  26. /// 随机活体检测动作数
  27. var livenessRandomCount = FaceEnvironment.VALUE_LIVENESS_DEFAULT_RANDOM_COUNT;
  28. /// 闭眼阈值
  29. var eyeClosedValue = FaceEnvironment.VALUE_CLOSE_EYES;
  30. /// 图片缓存数量
  31. var cacheImageNum = FaceEnvironment.VALUE_CACHE_IMAGE_NUM;
  32. /// 原图缩放系数
  33. var scale = FaceEnvironment.VALUE_SCALE;
  34. /// 加密类型,0:Base64加密,上传时image_sec传false;1:百度加密文件加密,上传时image_sec传true
  35. var secType = FaceEnvironment.VALUE_SEC_TYPE;
  36. /// 活体检测的动作类型列表
  37. List<LivenessType> livenessTypeList = [
  38. LivenessType.Eye,
  39. LivenessType.Mouth,
  40. LivenessType.HeadUp,
  41. LivenessType.HeadDown,
  42. LivenessType.HeadLeft,
  43. LivenessType.HeadRight
  44. ];
  45. toJson() {
  46. return {
  47. 'brightnessValue': this.brightnessValue,
  48. 'blurnessValue': this.blurnessValue,
  49. 'occlusionValue': this.occlusionValue,
  50. 'headPitchValue': this.headPitchValue,
  51. 'headYawValue': this.headYawValue,
  52. 'headRollValue': this.headRollValue,
  53. 'cropHeight': this.cropHeight,
  54. 'minFaceSize': this.minFaceSize,
  55. 'notFaceValue': this.notFaceValue,
  56. 'isSound': this.isSound,
  57. 'isLivenessRandom': this.isLivenessRandom,
  58. 'livenessRandomCount': this.livenessRandomCount,
  59. 'livenessTypeList':
  60. this.livenessTypeList.map((item) => item.index).toList(),
  61. 'eyeClosedValue': this.eyeClosedValue,
  62. 'cacheImageNum': this.cacheImageNum,
  63. 'scale': this.scale,
  64. 'secType': this.secType
  65. };
  66. }
  67. }