APBToygerFacadeDefine.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // APFCherryDefine.h
  3. // APBToygerFacade
  4. //
  5. // Created by shouyi.www on 27/02/2017.
  6. // Copyright © 2017 DTF. All rights reserved.
  7. //
  8. #ifndef APBToygerFacadeDefine_h
  9. #define APBToygerFacadeDefine_h
  10. static float normalized_distance(float current_value, float best_value, float range) {
  11. return fabsf((current_value - best_value) / range);
  12. }
  13. //typedef struct toyger_status_evaluator_t {
  14. // float pitch;
  15. // float yaw;
  16. // float width;
  17. //
  18. // float best_pitch;
  19. // float best_yaw;
  20. // float best_width;
  21. // float pitch_range;
  22. // float yaw_range;
  23. // float width_range;
  24. // float pitch_weight;
  25. // float yaw_weight;
  26. // float width_weight;
  27. //
  28. // toyger_status_evaluator_t(float pitch_ = -0.3, float pitch_range_ = 0.7, float best_pitch_ = 0, float pitch_weight_ = 1,
  29. // float yaw_ = -0.6, float yaw_range_ = 0.6, float best_yaw_ = 0, float yaw_weight_ = 1,
  30. // float width_ = 0.2, float width_range_ = 1.2, float best_width_ = 0.7, float width_weight_ = 1){
  31. // pitch = pitch_;
  32. // yaw = yaw_;
  33. // width = width_;
  34. // pitch_range = pitch_range_;
  35. // yaw_range = yaw_range_;
  36. // width_range = width_range_;
  37. // best_pitch = best_pitch_;
  38. // best_yaw = best_yaw_;
  39. // best_width = best_width_;
  40. // pitch_weight = pitch_weight_;
  41. // yaw_weight = yaw_weight_;
  42. // width_weight = width_weight_;
  43. // }
  44. //
  45. // void reset(){
  46. // pitch = -0.3;
  47. // yaw = -0.6;
  48. // width = 0.2;
  49. // }
  50. //
  51. // void update(float pitch_, float yaw_, float width_) {
  52. // pitch = pitch_;
  53. // yaw = yaw_;
  54. // width = width_;
  55. // }
  56. //
  57. // float evaluateProgress(float pitch_, float yaw_, float width_){
  58. // return
  59. // (normalized_distance(pitch_, best_pitch, pitch_range) * pitch_weight +
  60. // normalized_distance(yaw_, best_yaw, yaw_range) * yaw_weight +
  61. // normalized_distance(width_, best_width, width_range) * width_weight) /
  62. // (pitch_weight + yaw_weight + width_weight);
  63. // }
  64. //
  65. // float evaluate(){
  66. // return 1 -
  67. // (normalized_distance(pitch, best_pitch, pitch_range) * pitch_weight +
  68. // normalized_distance(yaw, best_yaw, yaw_range) * yaw_weight +
  69. // normalized_distance(width, best_width, width_range) * width_weight) /
  70. // (pitch_weight + yaw_weight + width_weight);
  71. // }
  72. //
  73. //}ToygerStatusEvaluator;
  74. typedef struct apbtoyger_tip_evaluator_t {
  75. bool pose_end;
  76. bool has_face;
  77. bool did_blink;
  78. bool pos_okay;
  79. bool quality_okay;
  80. bool under_exposure;
  81. bool face_width_too_small;
  82. bool face_width_too_big;
  83. bool integrity_fail;
  84. bool yaw_fail;
  85. bool pitch_fail;
  86. bool tremble_fail;
  87. bool did_checkSeven;
  88. int tip_timer_wait_cnt;
  89. bool tip_show_switch;
  90. int tip_message;
  91. apbtoyger_tip_evaluator_t(){
  92. reset();
  93. }
  94. void reset(){
  95. has_face = false;
  96. did_blink = false;
  97. pos_okay = false;
  98. under_exposure = false;
  99. face_width_too_small = false;
  100. integrity_fail = false;
  101. pitch_fail = false;
  102. face_width_too_big = false;
  103. yaw_fail = false;
  104. tremble_fail = false;
  105. tip_timer_wait_cnt = 0;
  106. tip_show_switch = true;
  107. did_checkSeven = false;
  108. quality_okay = false;
  109. pose_end = false;
  110. tip_message =0;
  111. }
  112. }APBToygerTipEvaluator;
  113. //UI样式
  114. typedef enum : NSUInteger {
  115. APBToygerUIStyleFPPCherry = 991, //991 FPP樱桃(废弃)
  116. APBToygerUIStyleCherry, //992 zFace樱桃
  117. APBToygerUIStyleGarfield, //993 加菲
  118. } APBToygerUIStyle;
  119. #endif