Skip to main content

smart_document_capture_tesseract 0.1.0 copy "smart_document_capture_tesseract: ^0.1.0" to clipboard
smart_document_capture_tesseract: ^0.1.0 copied to clipboard

Offline Tesseract OCR engine for smart_document_capture, with Persian and English support, word boxes and per-word confidence from hOCR output.

example/smart_document_capture_tesseract_example.dart

// Reads a receipt photo with Tesseract and prints the extracted fields.
//
// The app must bundle `assets/tessdata_config.json` and the trained data
// (see the package README).
import 'package:smart_document_capture/smart_document_capture.dart';
import 'package:smart_document_capture_tesseract/smart_document_capture_tesseract.dart';

Future<void> readReceipt(String imagePath) async {
  final DocumentCapture capture = DocumentCapture(
    engine: TesseractOcrEngine(),
    options: const OcrOptions(languages: <String>['fas', 'eng']),
  );

  final ExtractionResult result = await capture.process(
    DocumentImage.file(imagePath),
    ReceiptSchema.persian,
  );

  for (final ExtractedField field in result.fields.values) {
    // ignore: avoid_print
    print('${field.label}: ${field.value} '
        '(${(field.confidence * 100).round()}%)');
  }
  if (result.needsReview()) {
    // Show DocumentReviewView so a person can check the doubtful fields.
  }
  await capture.dispose();
}
1
likes
160
points
47
downloads

Documentation

API reference

Publisher

verified publishermohammadkhadem.ir

Weekly Downloads

Offline Tesseract OCR engine for smart_document_capture, with Persian and English support, word boxes and per-word confidence from hOCR output.

Repository (GitHub)
View/report issues

Topics

#ocr #tesseract #text-recognition #persian

License

MIT (license)

Dependencies

flutter, flutter_tesseract_ocr, smart_document_capture

More

Packages that depend on smart_document_capture_tesseract