pub struct OcrOptions {
pub languages: Vec<String>,
pub single_line: bool,
pub charset: Option<String>,
pub remove_rules: bool,
pub auto_orient: bool,
}Fields§
§languages: Vec<String>Language hints (engine-specific tags); empty = engine default.
single_line: boolThe image IS one text line: skip detection, recognize the whole
frame as a single line (tesseract’s --psm 7). LIVE’s dirty-band
path sets this when a band’s known geometry is a single line —
detection becomes async maintenance, recognition the only
synchronous work.
charset: Option<String>Restrict recognition to exactly these characters — "0123456789$,.-"
for an amount field, "0123456789/" for a date. None reads freely.
For a field whose content class is known this removes a whole class of
look-alike errors (1→T, 0→O, 5→S) instead of leaving them
for the caller to guess at. The reported confidence is the model’s own
probability for the character it was allowed to emit, NOT renormalised
over the allowed set, so a line the model wanted to read as letters
comes back with LOW confidence rather than as a confident digit.
An engine that cannot constrain its decoder must return an error when this is set — never read freely and ignore it. A character the model cannot emit at all is also an error, naming the character.
remove_rules: boolErase horizontal form rules (field lines, strike-throughs, table
rules) before reading. A typed value sitting on a field line fuses with
it — 1 reads as T, 0 as U — and the recognizer is confident
about the result. Off by default: it changes what every ruled page
reads, so it is asked for per call, by callers reading forms.
Engines that do not implement it must return an error when it is set.
auto_orient: boolDetect which quarter turn makes the page upright, and read it that way. Scanners store portrait forms sideways and phones photograph in any orientation; read sideways, a page silently comes back as a few low-confidence lines. Returned boxes stay in the INPUT image’s coordinates. Off by default: it costs an extra detection pass.
Engines that do not implement it must return an error when it is set.
Trait Implementations§
Source§impl Clone for OcrOptions
impl Clone for OcrOptions
Source§impl Debug for OcrOptions
impl Debug for OcrOptions
Auto Trait Implementations§
impl Freeze for OcrOptions
impl RefUnwindSafe for OcrOptions
impl Send for OcrOptions
impl Sync for OcrOptions
impl Unpin for OcrOptions
impl UnsafeUnpin for OcrOptions
impl UnwindSafe for OcrOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more