pub struct OcrResult {
pub text: String,
pub accuracy: f64,
}Expand description
OCR result containing recognized text and accuracy measurement
This struct is returned by read_image_with_accuracy and contains both
the recognized text and the accuracy score when compared against ground truth.
§Fields
text- The recognized text from the OCR processaccuracy- A percentage value (0-100) indicating how closely the recognized text matches the ground truth
§Example
use monocr_onnx::read_image_with_accuracy;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result = read_image_with_accuracy("test.png", "Hello World").await?;
if result.accuracy >= 90.0 {
println!("Good recognition: {}", result.text);
} else {
println!("Poor recognition: {} ({}% accuracy)", result.text, result.accuracy);
}
Ok(())
}Fields§
§text: StringThe recognized text from the image
accuracy: f64Accuracy percentage (0-100) based on Levenshtein distance
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OcrResult
impl RefUnwindSafe for OcrResult
impl Send for OcrResult
impl Sync for OcrResult
impl Unpin for OcrResult
impl UnsafeUnpin for OcrResult
impl UnwindSafe for OcrResult
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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