MBCOcrLayout

Objective-C


@interface MBCOcrLayout : NSObject

Swift

class MBCOcrLayout : 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

MBCOcrBlock

See

MBCOcrLine

See

MBCOcrChar
  • 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<MBCOcrBlock *> *_Nonnull blocks;

    Swift

    var blocks: [MBCOcrBlock] { 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) MBCPosition *_Nonnull position;

    Swift

    var position: MBCPosition { 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<MBCOcrBlock *> *)ocrBlocks
                                    transform:(CGAffineTransform)transform
                                          box:(CGRect)box
                                      flipped:(BOOL)flipped;

    Swift

    init(ocrBlocks: [MBCOcrBlock], 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