Skip to main content

wordfeud_ocr/
lib.rs

1
2#![doc(html_logo_url = "https://github.com/jensanjo/wordfeud-ocr/raw/master/images/logo-ocr.png", html_favicon_url = "https://github.com/jensanjo/wordfeud-ocr/raw/master/images/logo-ocr.png")]
3//! An OCR library that reads the state of a Wordfeud board from a screenshot
4//!
5//! This library recognizes the tiles on a Wordfeud board and rack, and also the bonus squares on the board.
6//!
7//! # Basic usage
8//! ```no_run
9//! # use wordfeud_ocr::{Board, Error};
10//! # use anyhow::Result;
11//! let path = "screenshots/screenshot_english.png";
12//! let gray = image::open(path)?.into_luma8();
13//! let board = Board::new();
14//! let result = board.recognize_screenshot(&gray)?;
15//! println!("Tiles:\n{}", result.tiles_ocr);
16//! # Ok::<(), Error>(())
17//! ```
18
19mod error;
20mod layout;
21mod recognizer;
22mod utils;
23
24pub use error::Error;
25pub use layout::Layout;
26pub use recognizer::{Board, Ocr, OcrResults, OcrStat, OcrStats};
27pub use utils::{collage, save_templates};