FaceDetectorYN.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. //
  2. // This file is auto-generated. Please don't modify it!
  3. //
  4. #pragma once
  5. #ifdef __cplusplus
  6. //#import "opencv.hpp"
  7. #import "opencv2/objdetect.hpp"
  8. #import "opencv2/objdetect/face.hpp"
  9. #else
  10. #define CV_EXPORTS
  11. #endif
  12. #import <Foundation/Foundation.h>
  13. @class Mat;
  14. @class Size2i;
  15. NS_ASSUME_NONNULL_BEGIN
  16. // C++: class FaceDetectorYN
  17. /**
  18. * DNN-based face detector
  19. *
  20. * model download link: https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet
  21. *
  22. * Member of `Objdetect`
  23. */
  24. CV_EXPORTS @interface FaceDetectorYN : NSObject
  25. #ifdef __cplusplus
  26. @property(readonly)cv::Ptr<cv::FaceDetectorYN> nativePtr;
  27. #endif
  28. #ifdef __cplusplus
  29. - (instancetype)initWithNativePtr:(cv::Ptr<cv::FaceDetectorYN>)nativePtr;
  30. + (instancetype)fromNative:(cv::Ptr<cv::FaceDetectorYN>)nativePtr;
  31. #endif
  32. #pragma mark - Methods
  33. //
  34. // void cv::FaceDetectorYN::setInputSize(Size input_size)
  35. //
  36. /**
  37. * Set the size for the network input, which overwrites the input size of creating model. Call this method when the size of input image does not match the input size when creating model
  38. *
  39. * @param input_size the size of the input image
  40. */
  41. - (void)setInputSize:(Size2i*)input_size NS_SWIFT_NAME(setInputSize(input_size:));
  42. //
  43. // Size cv::FaceDetectorYN::getInputSize()
  44. //
  45. - (Size2i*)getInputSize NS_SWIFT_NAME(getInputSize());
  46. //
  47. // void cv::FaceDetectorYN::setScoreThreshold(float score_threshold)
  48. //
  49. /**
  50. * Set the score threshold to filter out bounding boxes of score less than the given value
  51. *
  52. * @param score_threshold threshold for filtering out bounding boxes
  53. */
  54. - (void)setScoreThreshold:(float)score_threshold NS_SWIFT_NAME(setScoreThreshold(score_threshold:));
  55. //
  56. // float cv::FaceDetectorYN::getScoreThreshold()
  57. //
  58. - (float)getScoreThreshold NS_SWIFT_NAME(getScoreThreshold());
  59. //
  60. // void cv::FaceDetectorYN::setNMSThreshold(float nms_threshold)
  61. //
  62. /**
  63. * Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value
  64. *
  65. * @param nms_threshold threshold for NMS operation
  66. */
  67. - (void)setNMSThreshold:(float)nms_threshold NS_SWIFT_NAME(setNMSThreshold(nms_threshold:));
  68. //
  69. // float cv::FaceDetectorYN::getNMSThreshold()
  70. //
  71. - (float)getNMSThreshold NS_SWIFT_NAME(getNMSThreshold());
  72. //
  73. // void cv::FaceDetectorYN::setTopK(int top_k)
  74. //
  75. /**
  76. * Set the number of bounding boxes preserved before NMS
  77. *
  78. * @param top_k the number of bounding boxes to preserve from top rank based on score
  79. */
  80. - (void)setTopK:(int)top_k NS_SWIFT_NAME(setTopK(top_k:));
  81. //
  82. // int cv::FaceDetectorYN::getTopK()
  83. //
  84. - (int)getTopK NS_SWIFT_NAME(getTopK());
  85. //
  86. // int cv::FaceDetectorYN::detect(Mat image, Mat& faces)
  87. //
  88. /**
  89. * Detects faces in the input image. Following is an example output.
  90. *
  91. * ![image](pics/lena-face-detection.jpg)
  92. *
  93. * @param image an image to detect
  94. * @param faces detection results stored in a 2D cv::Mat of shape [num_faces, 15]
  95. * - 0-1: x, y of bbox top left corner
  96. * - 2-3: width, height of bbox
  97. * - 4-5: x, y of right eye (blue point in the example image)
  98. * - 6-7: x, y of left eye (red point in the example image)
  99. * - 8-9: x, y of nose tip (green point in the example image)
  100. * - 10-11: x, y of right corner of mouth (pink point in the example image)
  101. * - 12-13: x, y of left corner of mouth (yellow point in the example image)
  102. * - 14: face score
  103. */
  104. - (int)detect:(Mat*)image faces:(Mat*)faces NS_SWIFT_NAME(detect(image:faces:));
  105. //
  106. // static Ptr_FaceDetectorYN cv::FaceDetectorYN::create(String model, String config, Size input_size, float score_threshold = 0.9f, float nms_threshold = 0.3f, int top_k = 5000, int backend_id = 0, int target_id = 0)
  107. //
  108. /**
  109. * Creates an instance of this class with given parameters
  110. *
  111. * @param model the path to the requested model
  112. * @param config the path to the config file for compability, which is not requested for ONNX models
  113. * @param input_size the size of the input image
  114. * @param score_threshold the threshold to filter out bounding boxes of score smaller than the given value
  115. * @param nms_threshold the threshold to suppress bounding boxes of IoU bigger than the given value
  116. * @param top_k keep top K bboxes before NMS
  117. * @param backend_id the id of backend
  118. * @param target_id the id of target device
  119. */
  120. + (FaceDetectorYN*)create:(NSString*)model config:(NSString*)config input_size:(Size2i*)input_size score_threshold:(float)score_threshold nms_threshold:(float)nms_threshold top_k:(int)top_k backend_id:(int)backend_id target_id:(int)target_id NS_SWIFT_NAME(create(model:config:input_size:score_threshold:nms_threshold:top_k:backend_id:target_id:));
  121. /**
  122. * Creates an instance of this class with given parameters
  123. *
  124. * @param model the path to the requested model
  125. * @param config the path to the config file for compability, which is not requested for ONNX models
  126. * @param input_size the size of the input image
  127. * @param score_threshold the threshold to filter out bounding boxes of score smaller than the given value
  128. * @param nms_threshold the threshold to suppress bounding boxes of IoU bigger than the given value
  129. * @param top_k keep top K bboxes before NMS
  130. * @param backend_id the id of backend
  131. */
  132. + (FaceDetectorYN*)create:(NSString*)model config:(NSString*)config input_size:(Size2i*)input_size score_threshold:(float)score_threshold nms_threshold:(float)nms_threshold top_k:(int)top_k backend_id:(int)backend_id NS_SWIFT_NAME(create(model:config:input_size:score_threshold:nms_threshold:top_k:backend_id:));
  133. /**
  134. * Creates an instance of this class with given parameters
  135. *
  136. * @param model the path to the requested model
  137. * @param config the path to the config file for compability, which is not requested for ONNX models
  138. * @param input_size the size of the input image
  139. * @param score_threshold the threshold to filter out bounding boxes of score smaller than the given value
  140. * @param nms_threshold the threshold to suppress bounding boxes of IoU bigger than the given value
  141. * @param top_k keep top K bboxes before NMS
  142. */
  143. + (FaceDetectorYN*)create:(NSString*)model config:(NSString*)config input_size:(Size2i*)input_size score_threshold:(float)score_threshold nms_threshold:(float)nms_threshold top_k:(int)top_k NS_SWIFT_NAME(create(model:config:input_size:score_threshold:nms_threshold:top_k:));
  144. /**
  145. * Creates an instance of this class with given parameters
  146. *
  147. * @param model the path to the requested model
  148. * @param config the path to the config file for compability, which is not requested for ONNX models
  149. * @param input_size the size of the input image
  150. * @param score_threshold the threshold to filter out bounding boxes of score smaller than the given value
  151. * @param nms_threshold the threshold to suppress bounding boxes of IoU bigger than the given value
  152. */
  153. + (FaceDetectorYN*)create:(NSString*)model config:(NSString*)config input_size:(Size2i*)input_size score_threshold:(float)score_threshold nms_threshold:(float)nms_threshold NS_SWIFT_NAME(create(model:config:input_size:score_threshold:nms_threshold:));
  154. /**
  155. * Creates an instance of this class with given parameters
  156. *
  157. * @param model the path to the requested model
  158. * @param config the path to the config file for compability, which is not requested for ONNX models
  159. * @param input_size the size of the input image
  160. * @param score_threshold the threshold to filter out bounding boxes of score smaller than the given value
  161. */
  162. + (FaceDetectorYN*)create:(NSString*)model config:(NSString*)config input_size:(Size2i*)input_size score_threshold:(float)score_threshold NS_SWIFT_NAME(create(model:config:input_size:score_threshold:));
  163. /**
  164. * Creates an instance of this class with given parameters
  165. *
  166. * @param model the path to the requested model
  167. * @param config the path to the config file for compability, which is not requested for ONNX models
  168. * @param input_size the size of the input image
  169. */
  170. + (FaceDetectorYN*)create:(NSString*)model config:(NSString*)config input_size:(Size2i*)input_size NS_SWIFT_NAME(create(model:config:input_size:));
  171. @end
  172. NS_ASSUME_NONNULL_END