GSKOCR

Objective-C

@interface GSKOCR : NSObject

Swift

class GSKOCR : NSObject

Provides OCR capability for your application.

Warning

The SDK must be initialized with [GSK initWithLicenseKey:error:] first.
  • Recognize the text in the provided image

    This call is synchronous an can take some time so it’s advised to call it on background thread.

    Declaration

    Objective-C

    + (GSKOCRResult *_Nullable)
        recognizeTextForImageAtPath:(nonnull NSString *)imagePath
                   ocrConfiguration:(GSKOCRConfiguration *_Nullable)configuration
                         onProgress:(nonnull void (^)(float))progressBlock
                              error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func recognizeTextForImage(atPath imagePath: String, ocrConfiguration configuration: GSKOCRConfiguration?, onProgress progressBlock: @escaping (Float) -> Void) throws -> GSKOCRResult

    Parameters

    imagePath

    the path of the image to recognize. Ideally the image has been processed in black and white with [GSDK enhanceImage:withPostProcessing:error:] first. If not, set the preprocessed flag on the configuration object to NO.

    configuration

    Configuration for the OCR process, in particular the language in which the OCR is performed. Note that you must provided the appropriate trained data.

    progressBlock

    The progress between 0 and 1. Called on the same thread.

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    a GSKOCRResult object containing the result of the text recognition.