FIRVisionDocumentTextBlock.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #import <CoreGraphics/CoreGraphics.h>
  2. #import <Foundation/Foundation.h>
  3. @class FIRVisionDocumentTextParagraph;
  4. @class FIRVisionTextRecognizedBreak;
  5. @class FIRVisionTextRecognizedLanguage;
  6. NS_ASSUME_NONNULL_BEGIN
  7. /**
  8. * @enum VisionDocumentTextBlockType
  9. * An enum of document text block types.
  10. */
  11. typedef NS_ENUM(NSInteger, FIRVisionDocumentTextBlockType) {
  12. /**
  13. * Unknown document text block type.
  14. */
  15. FIRVisionDocumentTextBlockTypeUnknown,
  16. /**
  17. * Barcode document text block type.
  18. */
  19. FIRVisionDocumentTextBlockTypeBarcode,
  20. /**
  21. * Image document text block type.
  22. */
  23. FIRVisionDocumentTextBlockTypePicture,
  24. /**
  25. * Horizontal/vertical line box document text block type.
  26. */
  27. FIRVisionDocumentTextBlockTypeRuler,
  28. /**
  29. * Table document text block type.
  30. */
  31. FIRVisionDocumentTextBlockTypeTable,
  32. /**
  33. * Regular document text block type.
  34. */
  35. FIRVisionDocumentTextBlockTypeText,
  36. } NS_SWIFT_NAME(VisionDocumentTextBlockType);
  37. /**
  38. * A document text block recognized in an image that consists of an array of paragraphs.
  39. */
  40. NS_SWIFT_NAME(VisionDocumentTextBlock)
  41. @interface FIRVisionDocumentTextBlock : NSObject
  42. /**
  43. * The detected block type.
  44. */
  45. @property(nonatomic, readonly) FIRVisionDocumentTextBlockType type;
  46. /**
  47. * String representation of the document text block that was recognized.
  48. */
  49. @property(nonatomic, readonly) NSString *text;
  50. /**
  51. * An array of paragraphs in the block if the type is `VisionDocumentTextBlockType.text`. Otherwise,
  52. * the array is empty.
  53. */
  54. @property(nonatomic, readonly) NSArray<FIRVisionDocumentTextParagraph *> *paragraphs;
  55. /**
  56. * The rectangle that contains the document text block relative to the image in the default
  57. * coordinate space.
  58. */
  59. @property(nonatomic, readonly) CGRect frame;
  60. /**
  61. * The confidence of the recognized document text block.
  62. */
  63. @property(nonatomic, readonly) NSNumber *confidence;
  64. /**
  65. * An array of recognized languages in the document text block. If no languages are recognized, the
  66. * array is empty.
  67. */
  68. @property(nonatomic, readonly) NSArray<FIRVisionTextRecognizedLanguage *> *recognizedLanguages;
  69. /**
  70. * The recognized start or end of the document text block.
  71. */
  72. @property(nonatomic, readonly, nullable) FIRVisionTextRecognizedBreak *recognizedBreak;
  73. /**
  74. * Unavailable.
  75. */
  76. - (instancetype)init NS_UNAVAILABLE;
  77. @end
  78. NS_ASSUME_NONNULL_END