passport_scanner 1.1.0 copy "passport_scanner: ^1.1.0" to clipboard
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 onScanned is 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.imagePath now points to a JPEG of the passport page cut out of the photo, and the new sourcePath keeps the photo as given. When the page cannot be found, imagePath is 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, and PassportImageScanner scans several images with one ML Kit recognizer. Both return a PassportScan carrying either a check-digit validated MRZResult or a PassportScanFailure. An image that yields nothing as stored is retried at 90°, 270° and 180°, so sideways and upside-down photos still scan.
  • Breaking: precision: N now means exactly N identical reads (it previously required N + 1, and precision: 1 could 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. precision must 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.
  • onNoMrzFound and onParsingFailed are throttled to at most once every 2 seconds; onParsingFailed fires 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 onScanned is 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: BarcodeFocusAreaPainter is replaced by ScanAreaPainter, and the internal ml_kit_utils library 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.
2
likes
160
points
164
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Scans passports with the device camera or from a gallery photo and extracts the MRZ (name, document number, nationality, dates) on Android and iOS.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

camerawesome, flutter, google_mlkit_commons, google_mlkit_text_recognition, image, image_picker, mrz_parser, path_provider

More

Packages that depend on passport_scanner