SBSDKBusinessCardsImageProcessor

@interface SBSDKBusinessCardsImageProcessor : NSObject

A class specifically designed to deal with images of business cards. It auto-rotates the images and extracts their texts. Can be subclassed and modified to your own needs. Designed to work in conjunction with SBSDKMultipleObjectScannerViewController.

  • If set to YES, performs text recognition on each image in the storage. Defaults to YES. Set to NO if you do not want text recognition or if your license does not cover OCR.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL performOCR;

    Swift

    var performOCR: Bool { get set }
  • If set to YES, performs automatic content based rotation of each image in the storage. Defaults to YES. Set to NO if you do not want automatic rotation or if your license does not cover automatic rotation.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL performAutoRotation;

    Swift

    var performAutoRotation: Bool { get set }
  • Processes the images contained in an image storage. Asynchronously performs auto-rotation and text recognition OCR) and returns the OCR results as well as the modified image storage in the completion handler.

    Declaration

    Objective-C

    - (void)processImageStorage:(nonnull id<SBSDKImageStoring>)storage
                   ocrLanguages:(nullable NSString *)languages
                     completion:
                         (nonnull void (^)(id<SBSDKImageStoring> _Nonnull,
                                           NSArray<SBSDKOCRResult *> *_Nullable))
                             completion;

    Swift

    func processImageStorage(_ storage: SBSDKImageStoring, ocrLanguages languages: String?, completion: @escaping (SBSDKImageStoring, [SBSDKOCRResult]?) -> Void)

    Parameters

    storage

    The image storage containing the business card images. Will be modified to auto-rotate contained images.

    ocrLanguages

    A string of two-letter ISO 639-1 language codes, separated by ‘+’, the OCR engine should use for recognition. E.g. de+en (german and english) ar+he+ja (arabic, hebrew and japanese). If the string is invalid or nil the user preferred languages are used. Ignores white spaces, invalid languages and invalid characters.

    completion

    The completion block which delivers the (modified) image storage and an array of OCR results.