A Flutter project that demonstrates how to use Dynamsoft Label Recognizer to scan MRZ (Machine Readable Zone) from passport, visa, and ID cards.
flutter-mrz-scanner.mp4
- Web
- Android
- iOS
- Windows
- Linux (Without camera support)
When the application is executed on desktop browsers, the camera frame appears mirrored. This has been observed to cause failures in the Machine Readable Zone (MRZ) detection process. Therefore, it's necessary to address this issue within the Flutter camera plugin.
A temporary workaround is to disable the camera flip code in https://github.com/flutter/packages/blob/main/packages/camera/camera_web/lib/src/camera_web.dart:
// final bool isBackCamera = getLensDirection() == CameraLensDirection.back;
// Flip the picture horizontally if it is not taken from a back camera.
// if (!isBackCamera) {
// canvas.context2D
// ..translate(videoWidth, 0)
// ..scale(-1, 1);
// }
-
Apply for a 30-day trial license and replace the license key in the
global.dart
file with your own:Future<int> initMRZSDK() async { await mrzDetector.init( "LICENSE-KEY"); return await mrzDetector.loadModel() ?? -1; }
-
Run the project:
flutter run # flutter run -d windows # flutter run -d edge # flutter run -d linux