This crate provides ergonomic Rust interface for underlying Tesseract OCR library.
There are two main structs: [TextRecognizer] and [LayoutAnalyzer].
TextRecognizer allows one to recognize text from the picture and outputs the text, the bounding boxes and other parameters.
LayoutAnalyzer allows one to analyze the layout without recognizing text; it should consume less memory than TextRecognizer.
Pictures can be loaded into the library via [Image] struct that accepts images in raw RGB/RGBA formats; no other formats are supported.
If you need to read an image from a file in another format, you can do so with any Rust crate (e.g. image).
Examples
Simple character recognition
use ;
use ImageReader;
let rgb = open.unwrap.decode.unwrap.into_rgb8;
let image = from_rgb.unwrap;
let mut recognizer = new.unwrap;
let results = recognizer.recognize_text.unwrap;
assert_eq!;
Print recognized text and corresponding bounding boxes
use ;
use ImageReader;
let rgb = open.unwrap.decode.unwrap.into_rgb8;
let image = from_rgb.unwrap;
let mut recognizer = new.unwrap;
let results = recognizer.recognize_text.unwrap;
let mut iter = results.iter;
while let Some = iter.next
Build customization
Please consult tesseract-ocr-static-c crate's documentation.