passport_scanner 1.1.0
passport_scanner: ^1.1.0 copied to clipboard
Scans passports with the device camera or from a gallery photo and extracts the MRZ (name, document number, nationality, dates) on Android and iOS.
1.1.0 #
- The image handed to
onScannedis now the passport page alone. Once the MRZ is confirmed, the page's edges are located in the frame around it — predicted from the ICAO 9303 page layout, then snapped to the edges actually visible — and the page is warped upright to the ID-3 aspect ratio (125 × 88). The JPEG no longer contains the desk, hands or the facing page that the scan-area rectangle let in, and a passport held at a slight angle comes out square. Detection runs on the whole frame, so a page that overhangs the outline is still captured whole. If the edges cannot be found (for example a page on a background of the same brightness), the scan area is cropped as before. - Still-image scans get the same treatment: on success,
PassportScan.imagePathnow points to a JPEG of the passport page cut out of the photo, and the newsourcePathkeeps the photo as given. When the page cannot be found,imagePathis the source photo, as before. - The JPEG is now rendered on a worker isolate, so the UI no longer stalls while the capture is encoded.
1.0.0 #
- Added still-image scanning:
scanPassportFromGallery()opens the system photo picker,scanPassportImage(path)reads an image already on disk, andPassportImageScannerscans several images with one ML Kit recognizer. Both return aPassportScancarrying either a check-digit validatedMRZResultor aPassportScanFailure. An image that yields nothing as stored is retried at 90°, 270° and 180°, so sideways and upside-down photos still scan. - Breaking:
precision: Nnow means exactly N identical reads (it previously required N + 1, andprecision: 1could never succeed). The default drops from 3 to 2 — every read is now check-digit validated, so two identical reads is a strong signal and scans complete faster.precisionmust be at least 1. - MRZ lines are selected by shape across all recognized text instead of assuming the last ML Kit block is the MRZ.
- Filler runs that ML Kit collapses (
<<<<<<<<<<<<<<<<read as<<<<<<<) are restored before parsing, and MRZ lines shortened that way are no longer discarded. When the collapse also swallowed the trailing check digits of an empty personal number, the composite check digit is computed rather than read; every other field is still verified against its own check digit. - Look-alike characters (
O/0,I/1,S/5,B/8,Z/2,G/6) are corrected by field position, and the document number is arbitrated with its check digit, so near-miss frames are recovered instead of discarded. onNoMrzFoundandonParsingFailedare throttled to at most once every 2 seconds;onParsingFailedfires only after arbitration also fails.- The scan-area overlay is now real: text recognition runs only on the frame region inside the passport-shaped outline, and the outline is drawn where the crop is taken, so what you aim at is what gets scanned. The outline has the ID-3 passport aspect ratio and is centred on the preview.
- Breaking: the image handed to
onScannedis now a crop of the scan area (the passport page as framed), rotated upright, instead of the full camera frame rotated by a fixed 90°. It honours the frame's real rotation on both platforms and the row stride of iOS buffers, so it is no longer sideways in landscape or sheared on devices that pad rows. - Breaking:
BarcodeFocusAreaPainteris replaced byScanAreaPainter, and the internalml_kit_utilslibrary is no longer published.
0.3.3 #
- Fixed image rotation for iOS
0.3.2 #
- Bug fix
0.3.1 #
- Added onNoMrzFound
0.3.0 #
- Save the scanned image file in the cache, and return the path of the saved image
- Added a button to toggle flash
0.2.0 (RETRACTED) #
- Enhance the UI.
- Return the path of the scanned image.
0.1.0 #
- First stable release.
- Added precision (the max number of duplicated scans before assuming that the result is correct).
- Added onParsingFailed listener.
0.0.3 #
- Updated README.md instructions for iOS and Android setup.
- Added an example app.
0.0.2 #
- Correction for pubspec.yaml.
0.0.1 #
- Initial release.