flutter_tesseract_ocr 0.3.3 copy "flutter_tesseract_ocr: ^0.3.3" to clipboard
flutter_tesseract_ocr: ^0.3.3 copied to clipboard

outdated

Tesseract 4 adds a new neural net (LSTM) based OCR engine which is focused on line recognition. It has unicode (UTF-8) support, and can recognize more than 100 languages.

Tesseract OCR for Flutter #

Tesseract OCR 4.0 for flutter This plugin is based on Tesseract OCR 4 This plugin uses Tesseract4Android and SwiftyTesseract.

pub.dev link

install #


dev_dependencies:
  ...
  flutter_tesseract_ocr:

android #

  1. android/build.gradle
 
 dependencies {
        classpath 'com.android.tools.build:gradle:3.6.2'
        ...
  }

  1. android/app/build.gradle
android {
  compileSdkVersion.....
  ...
  sourceSets {
        ...
  }
  packagingOptions{
      doNotStrip '*/mips/*.so'
      doNotStrip '*/mips64/*.so'
  }
}

Getting Started #

You must add trained data and trained data config file to your assets directory. You can find additional language trained data files here Trained language files

add tessdata folder under assets folder, add tessdata_config.json file under assets folder:

{
  "files": [
    "eng.traineddata",
    "<other_language>.traineddata"
  ]
}

Plugin assumes you have tessdata folder in your assets directory and defined in your pubspec.yaml

Check the contents of example/assets folder and example/pubspec.yaml

Usage #

Using is very simple:

//args android only 
String text = await TesseractOcr.extractText('/path/to/image', language: 'kor+eng',
        args: {
          "psm": "4",
          "preserve_interword_spaces": "1",
        });

You can leave language empty, it will default to `'eng'.

//---- dynamic add Tessdata ---- ▼
// https://github.com/tesseract-ocr/tessdata/raw/master/dan_frak.traineddata
// download and read Tessdata (Uint8List)

String newTessDataFile = "deu.traineddata";
Directory d = Directory(await TesseractOcr.getTessdataPath());
d.list().forEach((traineddata) {
  print(traineddata); //current traineddata
});
File('${d.path}/${newTessDataFile}').writeAsBytes([Uint8List bytes]);
//---- dynamic add Tessdata ---- ▲

152
likes
0
pub points
93%
popularity

Publisher

unverified uploader

Tesseract 4 adds a new neural net (LSTM) based OCR engine which is focused on line recognition. It has unicode (UTF-8) support, and can recognize more than 100 languages.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, path, path_provider

More

Packages that depend on flutter_tesseract_ocr