rusty-tesseract-1.0.0 is not a library.
Visit the last successful build:
rusty-tesseract-1.1.10
rusty-tesseract
A Rust wrapper for Google Tesseract
Description
- Brings all relevant command-line tesseract functionality to Rust
- Based on the Python wrapper for tesseract (i.e. https://github.com/madmaze/pytesseract)
- Enables testing a pre-trained tesseract model and outputting the results in different formats such as strings, bounding boxes, dicts, or dataframes.
Dependencies
Tesseract: https://github.com/tesseract-ocr/tesseract
Usage
1. Read Image
Create an Image object by specifying a path or alternatively an image array in (height, width, channel) format (similar to Python's numpy array for opencv). Note: Leave the Array3 parameter as is if you don't intend to use it.
let mut img = new;
// alternatively instantiate directly:
let mut img = Image ;
2. Set tesseract parameters
Set tesseract parameters using the Args struct.
let default_args = new;
// the default parameters are
/* pub fn new() -> Args {
Args {
config: HashMap::new(),
lang: "eng",
out_filename: "out",
dpi: 150,
boxfile: false
}
}
*/
// fill your own argument struct if needed
let mut my_args = Args ;
image_to_string_args.config.insert; // define page segmentation mode 6 (i.e. "Assume a single uniform block of text")
image_to_string_args.config.insert; // define optical character recognition mode 3 (i.e. "Default, based on what is available")
3. Get the tesseract model output
Choose either string, bounding box or data output:
// string output
let output = image_to_string;
println!;
// define bounding box parameters
let mut image_to_boxes_args = Args ;
image_to_boxes_args.config.insert;
image_to_boxes_args.config.insert;
// boxes printed in OUTPUT_DICT or OUTPUT_DATAFRAME format store the key as a string (i.e. the character) and
// store the value as a list of strings (if the same character occurs more than once)
let boxes = image_to_boxes;
println!;
// image_to_data prints out both the "image_to_string()" and "image_to_boxes()" information + a creates a TSV table with confidences
let data = image_to_data;
println!;
Get tesseract version
let tesseract_version = get_tesseract_version;
println!;
Contributing
- Fork the repository
- Create a new feature branch (
git checkout -b my-feature-branch-name) - Commit your new changes (
git commit -m 'commit message' <changed-file>) - Push changes to the branch (
git push origin my-feature-branch-name) - Create a Pull Request