MBOcrLayout

Objective-C


@interface MBOcrLayout : NSObject

Swift

class MBOcrLayout : NSObject

Class describing the layour of the document on which the OCR was preformed.

Ocr Layout contains one or mode OcrBlocks, each of which contains one or more OcrLines, Each of which contains one or more OcrChars.

Ocr layout coordinates and boxes are given in the coordinate system of the image on which the OCR was performed

See

MBOcrBlock

See

MBOcrLine

See

MBOcrChar
  • box

    Bounding box of the layout. Given in the coordinate system of the image on which OCR was performed.

    Declaration

    Objective-C

    @property (nonatomic) CGRect box;

    Swift

    var box: CGRect { get set }
  • Ocr blocks of the layout

    Declaration

    Objective-C

    @property (nonatomic) NSArray<MBOcrBlock *> *_Nonnull blocks;

    Swift

    var blocks: [MBOcrBlock] { get set }
  • Tranformation matrix which transforms the coordinate system in which the OCR layout is given (i.e. coordinate system of the image) to the coordinate system of the device screen.

    Tranform can be invalid (if there’s no camera UI to which it can be calculated). This can be checked with transformInvalid property.

    Declaration

    Objective-C

    @property (nonatomic) CGAffineTransform transform;

    Swift

    var transform: CGAffineTransform { get set }
  • YES if transform is not valid (e.g, there’s no UI to which it can be calculated. NO otherwise.

    Declaration

    Objective-C

    @property (nonatomic) BOOL transformInvalid;

    Swift

    var transformInvalid: Bool { get set }
  • Position of layout on the image, in the coordinate system of the image

    Declaration

    Objective-C

    @property (nonatomic) MBPosition *_Nonnull position;

    Swift

    var position: MBPosition { get set }
  • OCR layout was recognized from flipped image

    Declaration

    Objective-C

    @property (nonatomic) BOOL flipped;

    Swift

    var flipped: Bool { get set }
  • Initializer from blocks and transformation

    Declaration

    Objective-C

    - (nonnull instancetype)initWithOcrBlocks:
                                (nonnull NSArray<MBOcrBlock *> *)ocrBlocks
                                    transform:(CGAffineTransform)transform
                                          box:(CGRect)box
                                      flipped:(BOOL)flipped;

    Swift

    init(ocrBlocks: [MBOcrBlock], transform: CGAffineTransform, box: CGRect, flipped: Bool)

    Parameters

    ocrBlocks

    ocr blocks

    transform

    transform from the image to device screen

    Return Value

    initialized ocr layout

  • Initializer from blocks

    Declaration

    Objective-C

    - (nonnull instancetype)initWithOcrBlocks:(nonnull NSArray *)ocrBlocks;

    Swift

    convenience init(ocrBlocks: [Any])

    Parameters

    ocrBlocks

    ocr blocks

    Return Value

    initialized ocr layout

  • Helper method which returna a simple string representation of the ocr layout

    Declaration

    Objective-C

    - (nonnull NSString *)string;

    Swift

    func string() -> String

    Return Value

    ocr layout converted to string