Package-level declarations

Types

Link copied to clipboard
sealed interface CameraError

A failure to obtain a reading, reported on MrzScanResult.CaptureError; never thrown.

Link copied to clipboard

Telemetry emitted once per analysed frame, with diagnostics and no document data.

Link copied to clipboard

The outcome of analysing one frame, for telemetry.

Link copied to clipboard

Tracks the one running camera-session Job of a MrzCameraScanner.

Link copied to clipboard
data class CaptureMetadata(val reportedCaptureTime: String?, val deviceMake: String?, val deviceModel: String?, val software: String?, val location: GeoLocation?, val rawTags: Map<String, String>?)

Capture metadata (EXIF) read from a saved image, as the file reports it.

Link copied to clipboard

How much capture metadata a SavedImageMrzReader reads from a saved image.

Link copied to clipboard
fun interface CaptureMetadataReader<in F>

Reads capture metadata (EXIF) from a saved image.

Link copied to clipboard
data class CharacterDisambiguation(val lineIndex: Int, val columnIndex: Int, val recognized: Char, val resolved: Char)

One glyph change in an MrzCandidate: the recognized glyph at (lineIndex, columnIndex) was read as resolved.

Link copied to clipboard
sealed interface ConsensusVerdict

The outcome of offering one decoded frame to a MrzDecodeConsensus.

Link copied to clipboard

Where an analyzer's frames come from; sets the reading method on every result.

Link copied to clipboard
data class GeoLocation(val latitude: Double, val longitude: Double)

A GPS coordinate from a saved image's EXIF. Precise location: do not log verbatim.

Link copied to clipboard
@RequiresOptIn(level = RequiresOptIn.Level.ERROR, message = "Internal Tessera API, shared between Tessera's own modules. It can change or go away in any release.")
annotation class InternalTesseraApi

Marks a declaration that is public only so Tessera's own modules can share it (for example the camera modules sharing one rule from mrz-ocr-core). It is not part of Tessera's API: it can change or go away in any release, without notice and without a deprecation cycle.

Link copied to clipboard

Runs the platform camera and streams a MrzScanResult for analysed frames on results.

Link copied to clipboard
data class MrzCandidate(val mrzLines: List<String>, val parse: ParseResult, val disambiguations: List<CharacterDisambiguation>, val fillerPadding: MrzFillerPadding?)

One reconstruction of the recognized MRZ, listed by tolerant saved-image reading.

Link copied to clipboard
class MrzDecodeConsensus(val threshold: Int = DEFAULT_THRESHOLD)

Accepts a reading only after the same parsed document decodes on threshold frames.

Link copied to clipboard
data class MrzFillerPadding(val lineIndex: Int, val recognizedLength: Int, val paddedLength: Int)

Filler characters < that the reader added at the end of a name line that was read short.

Link copied to clipboard
class MrzFrameAnalyzer<F>(recognizer: MrzTextRecognizer<F>, mode: ParsingMode = ParsingMode.STRICT, telemetry: TelemetrySink = TelemetrySinkRegistry.current, referenceTimeProvider: () -> Instant = { Clock.System.now() })

Analyses one camera frame: runs OCR, locates an MRZ, parses it, and returns a MrzScanResult.

Link copied to clipboard

The pure rules both platform recognizers use to read a short MRZ row again (mrz-camera's ML Kit recognizer and mrz-camera-ios's Vision saved-image recognizer), kept here so both platforms follow ONE rule and it is tested once, in this module's commonTest. It is public only so those modules can call it, and marked InternalTesseraApi: not consumer API, left out of the ABI dumps, hidden from Swift.

Link copied to clipboard
sealed interface MrzScanResult

The outcome of analysing one frame.

Link copied to clipboard
fun interface MrzTextRecognizer<in F>

The OCR engine seam: turns a frame of type F into recognized text lines.

Link copied to clipboard

How tolerant candidate extraction is of OCR formatting noise.

Link copied to clipboard
class RecognizedLine(val text: String, val confidence: Float?, val secondRead: Boolean)

One line of recognized text, with its OCR confidence when reported.

Link copied to clipboard
data class RecognizedText(val lines: List<RecognizedLine>)

The text an OCR engine recognized in one frame, as lines in reading order.

Link copied to clipboard
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.

Link copied to clipboard

The caller's acknowledgement that enables saved-image MRZ reading.

Link copied to clipboard
data class SavedImageScanResult(val scan: MrzScanResult, val candidates: List<MrzCandidate>, val captureMetadata: CaptureMetadata?)

The result of reading one saved image: the scan outcome, any candidates, and capture metadata.

Link copied to clipboard
data class ScanQuality(val mrzRegionFound: Boolean, val ocrConfidence: Float?, val recognizedLineCount: Int)

Quality signals observed while analysing a frame. The SDK never refuses a result on quality grounds.

Functions

Link copied to clipboard
fun <F> MrzFrameAnalyzer<F>.scan(frames: Flow<F>, releaseFrame: (F) -> Unit = {}, captureErrorFor: (Throwable) -> CameraError? = { null }): Flow<MrzScanResult>

Turns a stream of platform frames into MrzScanResults, one per frame, in order.