FIRVision.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #import <CoreGraphics/CoreGraphics.h>
  2. #import <Foundation/Foundation.h>
  3. @class FIRApp;
  4. @class FIRVisionBarcodeDetector;
  5. @class FIRVisionBarcodeDetectorOptions;
  6. @class FIRVisionCloudDetectorOptions;
  7. @class FIRVisionCloudDocumentTextRecognizerOptions;
  8. @class FIRVisionCloudImageLabelerOptions;
  9. @class FIRVisionCloudLandmarkDetector;
  10. @class FIRVisionCloudTextRecognizerOptions;
  11. @class FIRVisionDocumentTextRecognizer;
  12. @class FIRVisionFaceDetector;
  13. @class FIRVisionFaceDetectorOptions;
  14. @class FIRVisionImageLabeler;
  15. @class FIRVisionOnDeviceImageLabelerOptions;
  16. @class FIRVisionTextRecognizer;
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * A Firebase service that supports vision APIs.
  20. */
  21. NS_SWIFT_NAME(Vision)
  22. @interface FIRVision : NSObject
  23. /**
  24. * Enables stats collection in ML Kit vision. The stats include API call counts, errors, API call
  25. * durations, options, etc. No personally identifiable information is logged.
  26. *
  27. * <p>The setting is per `FirebaseApp`, and therefore per `Vision`, and it is persistent across
  28. * launches of the app. It means if the user uninstalls the app or clears all app data, the setting
  29. * will be erased. The best practice is to set the flag in each initialization.
  30. *
  31. * <p>By default the logging is enabled. You have to specifically set it to false to disable
  32. * logging.
  33. */
  34. @property(nonatomic, getter=isStatsCollectionEnabled) BOOL statsCollectionEnabled;
  35. /**
  36. * Gets an instance of Firebase Vision service for the default Firebase app. This method is thread
  37. * safe. The default Firebase app instance must be configured before calling this method; otherwise,
  38. * raises FIRAppNotConfigured exception.
  39. *
  40. * @return A Firebase Vision service instance, initialized with the default Firebase app.
  41. */
  42. + (instancetype)vision NS_SWIFT_NAME(vision());
  43. /**
  44. * Gets an instance of Firebase Vision service for the custom Firebase app. This method is thread
  45. * safe.
  46. *
  47. * @param app The custom Firebase app used for initialization. Raises FIRAppInvalid exception if
  48. * `app` is nil.
  49. * @return A Firebase Vision service instance, initialized with the custom Firebase app.
  50. */
  51. + (instancetype)visionForApp:(FIRApp *)app NS_SWIFT_NAME(vision(app:));
  52. /**
  53. * Unavailable.
  54. */
  55. - (instancetype)init NS_UNAVAILABLE;
  56. /**
  57. * Gets a barcode detector with the given options. The returned detector is not thread safe.
  58. *
  59. * @param options Options containing barcode detector configuration.
  60. * @return A barcode detector configured with the given options.
  61. */
  62. - (FIRVisionBarcodeDetector *)barcodeDetectorWithOptions:(FIRVisionBarcodeDetectorOptions *)options
  63. NS_SWIFT_NAME(barcodeDetector(options:));
  64. /**
  65. * Gets a barcode detector with the default options. The returned detector is not thread safe.
  66. *
  67. * @return A barcode detector configured with the default options.
  68. */
  69. - (FIRVisionBarcodeDetector *)barcodeDetector;
  70. /**
  71. * Gets a face detector with the given options. The returned detector is not thread safe.
  72. *
  73. * @param options Options for configuring the face detector.
  74. * @return A face detector configured with the given options.
  75. */
  76. - (FIRVisionFaceDetector *)faceDetectorWithOptions:(FIRVisionFaceDetectorOptions *)options
  77. NS_SWIFT_NAME(faceDetector(options:));
  78. /**
  79. * Gets a face detector with the default options. The returned detector is not thread safe.
  80. *
  81. * @return A face detector configured with the default options.
  82. */
  83. - (FIRVisionFaceDetector *)faceDetector;
  84. /**
  85. * Gets an on-device image labeler with the given options. The returned image labeler is not thread
  86. * safe.
  87. *
  88. * @param options Options for configuring the image labeler.
  89. * @return An on-device image labeler configured with the given options.
  90. */
  91. - (FIRVisionImageLabeler *)onDeviceImageLabelerWithOptions:
  92. (FIRVisionOnDeviceImageLabelerOptions *)options NS_SWIFT_NAME(onDeviceImageLabeler(options:));
  93. /**
  94. * Gets an on-device image labeler with the default options. The returned image labeler is not
  95. * thread safe.
  96. *
  97. * @return An on-device image labeler configured with the default options.
  98. */
  99. - (FIRVisionImageLabeler *)onDeviceImageLabeler;
  100. /**
  101. * Gets an on-device text recognizer. The returned recognizer is not thread safe.
  102. *
  103. * @return A text recognizer.
  104. */
  105. - (FIRVisionTextRecognizer *)onDeviceTextRecognizer;
  106. /**
  107. * Gets a cloud text recognizer configured with the given options. The returned recognizer is not
  108. * thread safe.
  109. *
  110. * @param options Options for configuring the cloud text recognizer.
  111. * @return A text recognizer configured with the given options.
  112. */
  113. - (FIRVisionTextRecognizer *)cloudTextRecognizerWithOptions:
  114. (FIRVisionCloudTextRecognizerOptions *)options NS_SWIFT_NAME(cloudTextRecognizer(options:));
  115. /**
  116. * Gets a cloud text recognizer. The returned recognizer is not thread safe.
  117. *
  118. * @return A text recognizer.
  119. */
  120. - (FIRVisionTextRecognizer *)cloudTextRecognizer;
  121. /**
  122. * Gets a cloud document text recognizer configured with the given options. The returned recognizer
  123. * is not thread safe.
  124. *
  125. * @param options Options for configuring the cloud document text recognizer.
  126. * @return A document text recognizer configured with the given options.
  127. */
  128. - (FIRVisionDocumentTextRecognizer *)cloudDocumentTextRecognizerWithOptions:
  129. (FIRVisionCloudDocumentTextRecognizerOptions *)options
  130. NS_SWIFT_NAME(cloudDocumentTextRecognizer(options:));
  131. /**
  132. * Gets a cloud document text recognizer. The returned recognizer is not thread safe.
  133. *
  134. * @return A document text recognizer.
  135. */
  136. - (FIRVisionDocumentTextRecognizer *)cloudDocumentTextRecognizer;
  137. /**
  138. * Gets an instance of cloud landmark detector with the given options.
  139. *
  140. * @param options Options for configuring the cloud landmark detector.
  141. * @return A cloud landmark detector configured with the given options.
  142. */
  143. - (FIRVisionCloudLandmarkDetector *)cloudLandmarkDetectorWithOptions:
  144. (FIRVisionCloudDetectorOptions *)options
  145. NS_SWIFT_NAME(cloudLandmarkDetector(options:));
  146. /**
  147. * Gets an instance of cloud landmark detector with default options.
  148. *
  149. * @return A cloud landmark detector configured with default options.
  150. */
  151. - (FIRVisionCloudLandmarkDetector *)cloudLandmarkDetector;
  152. /*
  153. * Gets an instance of cloud image labeler with the given options.
  154. *
  155. * @param options Options for configuring the cloud image labeler.
  156. * @return A cloud image labeler configured with the given options.
  157. */
  158. - (FIRVisionImageLabeler *)cloudImageLabelerWithOptions:(FIRVisionCloudImageLabelerOptions *)options
  159. NS_SWIFT_NAME(cloudImageLabeler(options:));
  160. /**
  161. * Gets an instance of cloud image labeler with default options.
  162. *
  163. * @return A cloud image labeler configured with default options.
  164. */
  165. - (FIRVisionImageLabeler *)cloudImageLabeler;
  166. @end
  167. NS_ASSUME_NONNULL_END