flutter_ocr_sdk 0.0.1 flutter_ocr_sdk: ^0.0.1 copied to clipboard
A new flutter plugin project.
flutter_ocr_sdk #
A wrapper for Dynamsoft OCR SDK, focusing on Passport MRZ recognition.
Try Passport MRZ Example #
cd example
flutter run -d <device>
Usage #
-
Download the model package. Unzip model files to
model/
folder, and configureassets
inpubspec.yaml
:assets: - model/ - model/CharacterModel/
-
Initialize the object and load the model path by the asset path:
_textRecognizer = FlutterOcrSdk(); _textRecognizer.loadModel('model/');
-
Recognize passport MRZ by setting an image file and the template name
locr
. The template name is defined inmodel/wholeImgMRZTemplate.json
:String ret = await _textRecognizer.recognizeByFile(image?.path, 'locr');
-
Recognize passport MRZ by setting an image buffer (E.g. CameraImage) and the template name
locr
:CameraImage availableImage; String ret = await _textRecognizer.recognizeByFile(availableImage.planes[0].bytes, availableImage.width, availableImage.height, availableImage.planes[0].bytesPerRow, format, 'locr');
-
Set the organization ID if you have a Dynamsoft account:
await _textRecognizer.setOrganizationID('YOUR-ID');