SBSDKMachineReadableZoneRecognizer

@interface SBSDKMachineReadableZoneRecognizer : NSObject

A class to recognize machine-readable zones in a UIImage or SampleBufferRef. Result is encapsulated in SBSDKMRZRecognizerResult instance. NOTE: In order to operate, this class requires tesseract languages and trained data to be present in application bundle

  • The number of frames to be accumulated results when recognizing machine readable zones. Lower values are more inaccurate but faster, higher values are more accurate but slower. Values less than or equal 1 effectively turn accumulation off. The default value is 4.

    Declaration

    Objective-C

    @property (nonatomic) NSUInteger resultAccumulationCount;

    Swift

    var resultAccumulationCount: UInt { get set }
  • Acquire all available information from UIImage instance containing machine-readable zone.

    Declaration

    Objective-C

    - (nullable SBSDKMachineReadableZoneRecognizerResult *)
        recognizePersonalIdentityFromImage:(nonnull UIImage *)image;

    Swift

    func recognizePersonalIdentity(from image: UIImage) -> SBSDKMachineReadableZoneRecognizerResult?

    Parameters

    image

    The image where machine-readable zone is to be detected.

    Return Value

    Recognizer result or nil.

  • Acquire all available information from previously extracted MRZ text.

    Declaration

    Objective-C

    - (nullable SBSDKMachineReadableZoneRecognizerResult *)
        recognizePersonalIdentityFromText:(nonnull NSString *)text;

    Swift

    func recognizePersonalIdentity(fromText text: String) -> SBSDKMachineReadableZoneRecognizerResult?

    Parameters

    text

    Text with extracted MRZ data.

    Return Value

    Recognizer result or nil.

  • Acquire all available information from sample buffer reference containing machine-readable zone.

    Declaration

    Objective-C

    - (nullable SBSDKMachineReadableZoneRecognizerResult *)
        recognizePersonalIdentityFromSampleBuffer:
            (nonnull CMSampleBufferRef)sampleBufferRef
                                      orientation:(AVCaptureVideoOrientation)
                                                      videoOrientation
                          machineReadableZoneRect:(CGRect)machineReadableZoneRect;

    Swift

    func recognizePersonalIdentity(from sampleBufferRef: CMSampleBuffer, orientation videoOrientation: AVCaptureVideoOrientation, machineReadableZoneRect: CGRect) -> SBSDKMachineReadableZoneRecognizerResult?

    Parameters

    sampleBufferRef

    The sample buffer reference containing machine-readable zone.

    videoOrientation

    Video frame orientation.

    machineReadableZoneRect

    Rectangle in frame containing machine-readable zone. Pass an empty rectangle if no frame is used.

    Return Value

    Recognizer result or nil.