UNPKG

blinkid-react-native

Version:

A small and powerful ID card scanning library. Powered by Microblink (www.microblink.com).

110 lines (94 loc) 2.86 kB
import { Recognizer, RecognizerResult } from '../recognizer' import { Date, Point, Quadrilateral, MrtdDocumentType, MrzResult, DocumentFaceDetectorType, Country, Region, Type, DocumentImageColorStatus, DocumentImageMoireStatus, AnonymizationMode, RecognitionModeFilter, StrictnessLevel, ClassFilter, ImageExtensionFactors, DataMatchResult, } from '../types' /** * Result object for PassportRecognizer. */ export class PassportRecognizerResult extends RecognizerResult { constructor(nativeResult) { super(nativeResult.resultState); /** * face image from the document if enabled with returnFaceImage property. */ this.faceImage = nativeResult.faceImage; /** * full document image if enabled with returnFullDocumentImage property. */ this.fullDocumentImage = nativeResult.fullDocumentImage; /** * The data extracted from the machine readable zone. */ this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; } } /** * Recognizer which can scan all passports with MRZ. */ export class PassportRecognizer extends Recognizer { constructor() { super('PassportRecognizer'); /** * Defines whether to anonymize Netherlands MRZ * * */ this.anonymizeNetherlandsMrz = true; /** * Defines if glare detection should be turned on/off. * * */ this.detectGlare = true; /** * Property for setting DPI for face images * Valid ranges are [100,400]. Setting DPI out of valid ranges throws an exception * * */ this.faceImageDpi = 250; /** * Property for setting DPI for full document images * Valid ranges are [100,400]. Setting DPI out of valid ranges throws an exception * * */ this.fullDocumentImageDpi = 250; /** * Image extension factors for full document image. * * @see ImageExtensionFactors * */ this.fullDocumentImageExtensionFactors = new ImageExtensionFactors(); /** * Sets whether face image from ID card should be extracted * * */ this.returnFaceImage = false; /** * Sets whether full document image of ID card should be extracted. * * */ this.returnFullDocumentImage = false; this.createResultFromNative = function (nativeResult) { return new PassportRecognizerResult(nativeResult); } } }