GMVDetectorConstants.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. #ifndef GMVDetector_GMVDetectorConstants_h
  2. #define GMVDetector_GMVDetectorConstants_h
  3. #import <Foundation/Foundation.h>
  4. /** @file GMVDetectorConstants.h
  5. * Detector constants.
  6. */
  7. /** Possible error codes returned by GMVDetector. */
  8. typedef NS_ENUM(NSInteger, GMVDetectorError) {
  9. GMVDetectorInvalidInput = -301
  10. };
  11. /**
  12. * @enum GMVImageOrientation
  13. * This enumeration specifies where the origin (0,0) of the image is located. The constant
  14. * has the same value as defined by EXIF specifications.
  15. */
  16. typedef NS_ENUM(NSInteger, GMVImageOrientation) {
  17. /**
  18. * Orientation code indicating the 0th row is the top and the 0th column is the left side.
  19. */
  20. GMVImageOrientationTopLeft = 1,
  21. /**
  22. * Orientation code indicating the 0th row is the top and the 0th column is the right side.
  23. */
  24. GMVImageOrientationTopRight = 2,
  25. /**
  26. * Orientation code indicating the 0th row is the bottom and the 0th column is the right side.
  27. */
  28. GMVImageOrientationBottomRight = 3,
  29. /**
  30. * Orientation code indicating the 0th row is the bottom and the 0th column is the left side.
  31. */
  32. GMVImageOrientationBottomLeft = 4,
  33. /**
  34. * Orientation code indicating the 0th row is the left side and the 0th column is the top.
  35. */
  36. GMVImageOrientationLeftTop = 5,
  37. /**
  38. * Orientation code indicating the 0th row is the right side and the 0th column is the top.
  39. */
  40. GMVImageOrientationRightTop = 6,
  41. /**
  42. * Orientation code indicating the 0th row is the right side and the 0th column is the bottom.
  43. */
  44. GMVImageOrientationRightBottom = 7,
  45. /**
  46. * Orientation code indicating the 0th row is the left side and the 0th column is the
  47. * bottom.
  48. */
  49. GMVImageOrientationLeftBottom = 8
  50. };
  51. /**
  52. * @enum GMVDetectorFaceModeOption
  53. * This enum specifies a preference for accuracy vs. speed trade-offs.
  54. */
  55. typedef NS_ENUM(NSInteger, GMVDetectorFaceModeOption) {
  56. /**
  57. * Face detection mode code indicating detect fewer faces and may be less precise in determining
  58. * values such as position, but will run faster.
  59. */
  60. GMVDetectorFaceFastMode = 200,
  61. /**
  62. * Face detection mode code indicating detect more faces and may be more precise in determining
  63. * values such as position, at the cost of speed.
  64. */
  65. GMVDetectorFaceAccurateMode = 201,
  66. /**
  67. * Face detection mode code indicating detect predominant faces appeared in self-photography
  68. * style and may be not detecting smaller and further away faces.
  69. */
  70. GMVDetectorFaceSelfieMode = 202
  71. };
  72. /**
  73. * @options GMVDetectorFaceLandmark
  74. * This option specifies the landmark detection type.
  75. */
  76. typedef NS_OPTIONS(NSInteger, GMVDetectorFaceLandmark) {
  77. /**
  78. * Face landmark option indicating it performs no landmark detection.
  79. */
  80. GMVDetectorFaceLandmarkNone = 1 << 0,
  81. /**
  82. * Face landmark option indicating it performs all landmark detection.
  83. */
  84. GMVDetectorFaceLandmarkAll = 1 << 1,
  85. /**
  86. * Face landmark option indicating it performs contour detection.
  87. */
  88. GMVDetectorFaceLandmarkContour = 1 << 2
  89. };
  90. /**
  91. * @options GMVDetectorFaceClassification
  92. * This option specifies the classification type.
  93. */
  94. typedef NS_OPTIONS(NSInteger, GMVDetectorFaceClassification) {
  95. /**
  96. * Face classification option indicating it performs no classification.
  97. */
  98. GMVDetectorFaceClassificationNone = 1 << 0,
  99. /**
  100. * Face classification option indicating it performs all classification.
  101. */
  102. GMVDetectorFaceClassificationAll = 1 << 1
  103. };
  104. /** This value is the default score threshold set on label detectors. */
  105. extern const float kGMVDetectorLabelScoreThresholdDefaultValue;
  106. /**
  107. * @enum GMVBarcodeFeatureEmailType
  108. * This enum specifies the email type for GMVBarcodeFeatureEmail.
  109. */
  110. typedef NS_ENUM(NSInteger, GMVBarcodeFeatureEmailType) {
  111. /**
  112. * Unknown email type.
  113. */
  114. GMVBarcodeFeatureEmailTypeUnknown = 0,
  115. /**
  116. * Barcode feature work email type.
  117. */
  118. GMVBarcodeFeatureEmailTypeWork = 1,
  119. /**
  120. * Barcode feature home email type.
  121. */
  122. GMVBarcodeFeatureEmailTypeHome = 2
  123. };
  124. /**
  125. * @enum GMVBarcodeFeaturePhoneType
  126. * This enum specifies the phone type for GMVBarcodeFeaturePhone.
  127. */
  128. typedef NS_ENUM(NSInteger, GMVBarcodeFeaturePhoneType) {
  129. /**
  130. * Unknown phone type.
  131. */
  132. GMVBarcodeFeaturePhoneTypeUnknown = 0,
  133. /**
  134. * Barcode feature work phone type.
  135. */
  136. GMVBarcodeFeaturePhoneTypeWork = 1,
  137. /**
  138. * Barcode feature home phone type.
  139. */
  140. GMVBarcodeFeaturePhoneTypeHome = 2,
  141. /**
  142. * Barcode feature fax phone type.
  143. */
  144. GMVBarcodeFeaturePhoneTypeFax = 3,
  145. /**
  146. * Barcode feature mobile phone type.
  147. */
  148. GMVBarcodeFeaturePhoneTypeMobile = 4
  149. };
  150. /**
  151. * @enum GMVBarcodeFeatureWiFiEncryptionType
  152. * This enum specifies the Wi-Fi encryption type for GMVBarcodeFeatureWiFi.
  153. */
  154. typedef NS_ENUM(NSInteger, GMVBarcodeFeatureWiFiEncryptionType) {
  155. /**
  156. * Barcode feature unknown Wi-Fi encryption type.
  157. */
  158. GMVBarcodeFeatureWiFiEncryptionTypeUnknown = 0,
  159. /**
  160. * Barcode feature open Wi-Fi encryption type.
  161. */
  162. GMVBarcodeFeatureWiFiEncryptionTypeOpen = 1,
  163. /**
  164. * Barcode feature WPA Wi-Fi encryption type.
  165. */
  166. GMVBarcodeFeatureWiFiEncryptionTypeWPA = 2,
  167. /**
  168. * Barcode feature WEP Wi-Fi encryption type.
  169. */
  170. GMVBarcodeFeatureWiFiEncryptionTypeWEP = 3
  171. };
  172. /**
  173. * @enum GMVBarcodeFeatureAddressType
  174. * This enum specifies address type.
  175. */
  176. typedef NS_ENUM(NSInteger, GMVBarcodeFeatureAddressType) {
  177. /**
  178. * Barcode feature unknown address type.
  179. */
  180. GMVBarcodeFeatureAddressTypeUnknown = 0,
  181. /**
  182. * Barcode feature work address type.
  183. */
  184. GMVBarcodeFeatureAddressTypeWork = 1,
  185. /**
  186. * Barcode feature home address type.
  187. */
  188. GMVBarcodeFeatureAddressTypeHome = 2
  189. };
  190. /**
  191. * @enum GMVDetectorBarcodeValueFormat
  192. * This enum specifies a barcode's value format. For example, TEXT, PRODUCT, URL, etc.
  193. */
  194. typedef NS_ENUM(NSInteger, GMVDetectorBarcodeValueFormat) {
  195. /**
  196. * Barcode value format for contact info.
  197. */
  198. GMVDetectorBarcodeValueFormatContactInfo = 1,
  199. /**
  200. * Barcode value format for email addresses.
  201. */
  202. GMVDetectorBarcodeValueFormatEmail = 2,
  203. /**
  204. * Barcode value format for ISBNs.
  205. */
  206. GMVDetectorBarcodeValueFormatISBN = 3,
  207. /**
  208. * Barcode value format for phone numbers.
  209. */
  210. GMVDetectorBarcodeValueFormatPhone = 4,
  211. /**
  212. * Barcode value format for product codes.
  213. */
  214. GMVDetectorBarcodeValueFormatProduct = 5,
  215. /**
  216. * Barcode value format for SMS details.
  217. */
  218. GMVDetectorBarcodeValueFormatSMS = 6,
  219. /**
  220. * Barcode value format for plain text.
  221. */
  222. GMVDetectorBarcodeValueFormatText = 7,
  223. /**
  224. * Barcode value format for URLs/bookmarks.
  225. */
  226. GMVDetectorBarcodeValueFormatURL = 8,
  227. /**
  228. * Barcode value format for Wi-Fi access point details.
  229. */
  230. GMVDetectorBarcodeValueFormatWiFi = 9,
  231. /**
  232. * Barcode value format for geographic coordinates.
  233. */
  234. GMVDetectorBarcodeValueFormatGeographicCoordinates = 10,
  235. /**
  236. * Barcode value format for calendar events.
  237. */
  238. GMVDetectorBarcodeValueFormatCalendarEvent = 11,
  239. /**
  240. * Barcode value format for driver's license data.
  241. */
  242. GMVDetectorBarcodeValueFormatDriversLicense = 12
  243. };
  244. /**
  245. * @options GMVDetectorBarcodeFormat
  246. * This option specifies the barcode formats that the library should detect.
  247. */
  248. typedef NS_OPTIONS(NSInteger, GMVDetectorBarcodeFormat) {
  249. /**
  250. * Code-128 detection.
  251. */
  252. GMVDetectorBarcodeFormatCode128 = 0x0001,
  253. /**
  254. * Code-39 detection.
  255. */
  256. GMVDetectorBarcodeFormatCode39 = 0x0002,
  257. /**
  258. * Code-93 detection.
  259. */
  260. GMVDetectorBarcodeFormatCode93 = 0x0004,
  261. /**
  262. * Codabar detection.
  263. */
  264. GMVDetectorBarcodeFormatCodaBar = 0x0008,
  265. /**
  266. * Data Matrix detection.
  267. */
  268. GMVDetectorBarcodeFormatDataMatrix = 0x0010,
  269. /**
  270. * EAN-13 detection.
  271. */
  272. GMVDetectorBarcodeFormatEAN13 = 0x0020,
  273. /**
  274. * EAN-8 detection.
  275. */
  276. GMVDetectorBarcodeFormatEAN8 = 0x0040,
  277. /**
  278. * ITF detection.
  279. */
  280. GMVDetectorBarcodeFormatITF = 0x0080,
  281. /**
  282. * QR Code detection.
  283. */
  284. GMVDetectorBarcodeFormatQRCode = 0x0100,
  285. /**
  286. * UPC-A detection.
  287. */
  288. GMVDetectorBarcodeFormatUPCA = 0x0200,
  289. /**
  290. * UPC-E detection.
  291. */
  292. GMVDetectorBarcodeFormatUPCE = 0x0400,
  293. /**
  294. * PDF-417 detection.
  295. */
  296. GMVDetectorBarcodeFormatPDF417 = 0x0800,
  297. /**
  298. * Aztec code detection.
  299. */
  300. GMVDetectorBarcodeFormatAztec = 0x1000
  301. };
  302. #pragma mark - Detector type constants
  303. /**
  304. * @memberof GMVDetector
  305. * A detector that searches for faces in a still image or video, returning GMVFaceFeature
  306. * objects that provide information about detected faces.
  307. */
  308. extern NSString * const GMVDetectorTypeFace;
  309. /**
  310. * @memberof GMVDetector
  311. * A detector that searches for barcodes in a still image or video, returning GMVBarcodeFeature
  312. * objects that provide information about detected barcodes.
  313. */
  314. extern NSString * const GMVDetectorTypeBarcode;
  315. /**
  316. * @memberof GMVDetector
  317. * A detector that does optical character recognition in a still image or video, returning
  318. * GMVTextBlockFeature objects that provide information about detected text.
  319. */
  320. extern NSString * const GMVDetectorTypeText;
  321. /**
  322. * @memberof GMVDetector
  323. * A detector that classifies a still image, returning GMVLabelFeature objects that provide
  324. * information about detected labels.
  325. */
  326. extern NSString * const GMVDetectorTypeLabel;
  327. #pragma mark - Label Detector Configuration Keys
  328. /**
  329. * @memberof GMVDetector
  330. * A key used to specify the score threshold for labels returned by the label detector, a float
  331. * value between 0 and 1.
  332. *
  333. * All features returned by the label detector have a score higher or equal to this threshold.
  334. * If unset, a default value of kGMVDetectorLabelScoreThresholdDefaultValue is used.
  335. */
  336. extern NSString * const GMVDetectorLabelScoreThreshold;
  337. #pragma mark - Barcode Detector Configuration Keys
  338. /**
  339. * @memberof GMVDetector
  340. * A key used to specify the barcode detection formats. If not specified, defaults to
  341. * GMVDetectorBarcodeFormatAllFormats.
  342. */
  343. extern NSString * const GMVDetectorBarcodeFormats;
  344. #pragma mark - Face Detector Configuration Keys
  345. /**
  346. * @memberof GMVDetector
  347. * A key used to specify detector's accuracy/speed trade-offs. If not specified, defaults to
  348. * GMVDetectorFaceFastMode.
  349. */
  350. extern NSString * const GMVDetectorFaceMode;
  351. /**
  352. * @memberof GMVDetector
  353. * A key used to specify is face tracking feature enabled. If not specified, defaults to false.
  354. */
  355. extern NSString * const GMVDetectorFaceTrackingEnabled;
  356. /**
  357. * @memberof GMVDetector
  358. * A key used to specify the smallest desired face size. The size is expressed as a proportion
  359. * of the width of the head to the image width. For example, if a value of 0.1 is specified, then
  360. * the smallest face to search for is roughly 10% of the width of the image being searched.
  361. * If not specified, defaults to 0.1.
  362. */
  363. extern NSString * const GMVDetectorFaceMinSize;
  364. /**
  365. * @memberof GMVDetector
  366. * A key used to specify whether to run additional classifiers for characterizing attributes
  367. * such as smiling. If not specified, defaults to GMVDetectorFaceClassificationNone.
  368. */
  369. extern NSString * const GMVDetectorFaceClassificationType;
  370. /**
  371. * @memberof GMVDetector
  372. * A key used to specify whether to detect no landmarks or all landmarks. Processing time
  373. * increases as the number of landmarks to search for increases, so detecting all landmarks
  374. * will increase the overall detection time. If not specified, defaults to
  375. * GMVDetectorFaceLandmarkNone.
  376. */
  377. extern NSString * const GMVDetectorFaceLandmarkType;
  378. #pragma mark - Detector Detection Configuration Keys
  379. /**
  380. * @memberof GMVDetector
  381. * A key used to specify the display orientation of the image for face feature detection. The
  382. * value of this key is an NSNumber wrapping a GMVImageOrientation.
  383. */
  384. extern NSString * const GMVDetectorImageOrientation;
  385. #pragma mark - Feature Types
  386. /**
  387. * @memberof GMVFeature
  388. * The discovered feature is a person’s face. Use the GMVFaceFeature class to get more
  389. * information about the detected feature.
  390. */
  391. extern NSString * const GMVFeatureTypeFace;
  392. /**
  393. * @memberof GMVFeature
  394. * The discovered feature is a barcode. Use the GMVBarcodeFeature class to get more
  395. * information about the detected feature.
  396. */
  397. extern NSString * const GMVFeatureTypeBarcode;
  398. /**
  399. * @memberof GMVFeature
  400. * The discovered feature is a text block. Use the GMVTextBlockFeature class to get more
  401. * information about the detected feature.
  402. */
  403. extern NSString * const GMVFeatureTypeTextBlock;
  404. /**
  405. * @memberof GMVFeature
  406. * The discovered feature is a text line. Use the GMVTextLineFeature class to get more
  407. * information about the detected feature.
  408. */
  409. extern NSString * const GMVFeatureTypeTextLine;
  410. /**
  411. * @memberof GMVFeature
  412. * The discovered feature is a text element. Use the GMVTextElementFeature class to get more
  413. * information about the detected feature.
  414. */
  415. extern NSString * const GMVFeatureTypeTextElement;
  416. /**
  417. * @memberof GMVFeature
  418. * The discovered feature is a label. Use the GMVLabelFeature class to get more information about
  419. * the detected feature.
  420. */
  421. extern NSString * const GMVFeatureTypeLabel;
  422. #endif // GMVDetector_GMVDetectorConstants_h