fromFile static method

Future<TesseractOcrTextExtractor> fromFile([
  1. String languageFileName = 'mrz'
])

Creates a TesseractOcrTextExtractor from a trained model file.

The languageFileName specifies the file to use. Files have to be stored in the assets/tessdata folder. The assets directory has to contain a tessdata_config.json file that lists the model files. For more information consult the https://pub.dev/packages/flutter_vision documentation.

Implementation

static Future<TesseractOcrTextExtractor> fromFile(
    [String languageFileName = 'mrz']) async {
  final flutterVision = FlutterVision();
  final instance = TesseractOcrTextExtractor(flutterVision: flutterVision);

  await flutterVision.loadTesseractModel(
    args: {
      'psm': '11',
      'oem': '1',
      'preserve_interword_spaces': '1',
    },
    language: languageFileName,
  );
  return instance;
}