FIRVisionImageLabeler.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #import <Foundation/Foundation.h>
  2. @class FIRVisionImageLabel;
  3. @class FIRVisionImage;
  4. NS_ASSUME_NONNULL_BEGIN
  5. /**
  6. * A block containing an array of labels or `nil` if there's an error.
  7. *
  8. * @param labels Array of labels detected in the image or `nil` if there was an error.
  9. * @param error The error or `nil`.
  10. */
  11. typedef void (^FIRVisionImageLabelerCallback)(NSArray<FIRVisionImageLabel *> *_Nullable labels,
  12. NSError *_Nullable error)
  13. NS_SWIFT_NAME(VisionImageLabelerCallback);
  14. /**
  15. * @enum VisionImageLabelerType
  16. * An enum of image labeler types.
  17. */
  18. typedef NS_ENUM(NSUInteger, FIRVisionImageLabelerType) {
  19. /** On-device image labeler type. */
  20. FIRVisionImageLabelerTypeOnDevice,
  21. /** Cloud image labeler type. */
  22. FIRVisionImageLabelerTypeCloud,
  23. } NS_SWIFT_NAME(VisionImageLabelerType);
  24. /**
  25. * An on-device or cloud image labeler for labeling images.
  26. */
  27. NS_SWIFT_NAME(VisionImageLabeler)
  28. @interface FIRVisionImageLabeler : NSObject
  29. /** The image labeler type. */
  30. @property(nonatomic, readonly) FIRVisionImageLabelerType type;
  31. /**
  32. * Unavailable. Use `Vision` factory methods.
  33. */
  34. - (instancetype)init NS_UNAVAILABLE;
  35. /**
  36. * Processes the given image for on-device or cloud image labeling.
  37. *
  38. * @param image The image to process.
  39. * @param completion Handler to call back on the main queue with labels or error.
  40. */
  41. - (void)processImage:(FIRVisionImage *)image
  42. completion:(FIRVisionImageLabelerCallback)completion
  43. NS_SWIFT_NAME(process(_:completion:));
  44. @end
  45. NS_ASSUME_NONNULL_END