SBSDKOCRResultBlock

@interface SBSDKOCRResultBlock : NSObject <NSCopying>

Part of the optical character recognitions result. This result contains multiple SBSDKOCRResultBlock objects. Each block represents a text paragraph, a text line or a word and contains information about it, like the found text, the bounding box, where in the image the paragraph/line/word can be found, the confidence value and the type. For convenience this immutable class conforms to NSCopying protocol.

  • The recognized text within the receivers bounding box.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull) NSString *text;

    Swift

    var text: String { get }
  • The bounding box of the receiver in normalized unit coordinate space Top, Left:(0.0, 0.0) - Width, Height(1.0, 1.0). Use the boundingBoxWithImageSize: method to get the bounding box in absolute image coordinates.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CGRect boundingBox;

    Swift

    var boundingBox: Rect { get }
  • The confidence value describes how confident the OCR engine was when detecting the letters and words. Ranges from 0.0 (not confident) to 100.0 (very confident).

    Declaration

    Objective-C

    @property (readonly, nonatomic) CGFloat confidenceValue;

    Swift

    var confidenceValue: Int32 { get }
  • The type of the block. See SBSDKOCRResultBlockType.

    Declaration

    Objective-C

    @property (readonly, nonatomic) SBSDKOCRResultBlockType blockType;

    Swift

    var blockType: SBSDKOCRResultBlockType { get }
  • Designated initializer.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithText:(nonnull NSString *)text
                             boundingBox:(CGRect)boundingBox
                         confidenceValue:(CGFloat)confidenceValue
                               blockType:(SBSDKOCRResultBlockType)blockType;

    Swift

    init(text: String, boundingBox: Any!, confidenceValue: Any!, blockType: SBSDKOCRResultBlockType)

    Parameters

    text

    The text of the block.

    boundingBox

    The bounding box of the block in normalized unit coordinates.

    confidenceValue

    The confidence value of the block.

    blockType

    The type of the block.

    Return Value

    Initialized instance of SBSDKOCRResultBlock.

  • Calculates the bounding box of the receiver in absolute image coordinate system.

    Declaration

    Objective-C

    - (CGRect)boundingBoxWithImageSize:(CGSize)imageSize;

    Swift

    func boundingBox(withImageSize imageSize: Any!) -> Any!

    Parameters

    imageSize

    The size of the image the box is scaled into.

    Return Value

    The bounding box in absolute image coordinate system.