SavedImageMrzReader

class SavedImageMrzReader<F>(acknowledgement: SavedImageReadingAcknowledgement, recognizer: MrzTextRecognizer<F>, mode: ParsingMode = ParsingMode.LENIENT, tolerant: Boolean = false, metadataReader: CaptureMetadataReader<F>? = null, metadataPolicy: CaptureMetadataPolicy = CaptureMetadataPolicy.NONE, telemetry: TelemetrySink = TelemetrySinkRegistry.current, referenceTimeProvider: () -> Instant = { Clock.System.now() }) : AutoCloseable

Reads an MRZ from one saved image.

Saved-image reading is off unless you pass a SavedImageReadingAcknowledgement. Results carry the reading method PRE_CAPTURED_IMAGE. The reader wraps a MrzFrameAnalyzer, so parsing and validation match a camera read. Close the reader to release the recognizer.

Since

0.3.0

Parameters

acknowledgement

the required acknowledgement. It has no default.

recognizer

the OCR engine for saved images.

mode

how tolerant line detection is of OCR formatting noise. The default is ParsingMode.LENIENT, because saved-image OCR can put stray spaces in an MRZ line and ParsingMode.STRICT then reports no MRZ.

tolerant

when true, SavedImageScanResult.candidates lists the reconstructions of ambiguous characters (see MrzCandidate). The default is false.

metadataReader

reads the capture metadata. When null, none is read. The default is null.

metadataPolicy

how much capture metadata to read. The default is CaptureMetadataPolicy.NONE.

telemetry

where per-read CameraFrameEvents go. The default is the registered sink (TelemetrySinkRegistry.current).

referenceTimeProvider

supplies the reference instant for date parsing. The default is the system clock.

Type Parameters

F

the saved-image input type that recognizer reads, for example android.net.Uri or NSURL.

Constructors

Link copied to clipboard
constructor(acknowledgement: SavedImageReadingAcknowledgement, recognizer: MrzTextRecognizer<F>, mode: ParsingMode = ParsingMode.LENIENT, tolerant: Boolean = false, metadataReader: CaptureMetadataReader<F>? = null, metadataPolicy: CaptureMetadataPolicy = CaptureMetadataPolicy.NONE, telemetry: TelemetrySink = TelemetrySinkRegistry.current, referenceTimeProvider: () -> Instant = { Clock.System.now() })

Functions

Link copied to clipboard
open override fun close()

Closes the recognizer if it is AutoCloseable.

Link copied to clipboard
suspend fun read(image: F): SavedImageScanResult

Reads image once and returns the result.