pub struct OAROCR { /* private fields */ }Expand description
OCR runtime for executing text detection and recognition.
This struct represents a configured OCR pipeline that can process images to extract text.
Implementations§
Source§impl OAROCR
impl OAROCR
Sourcepub fn predict(
&self,
images: Vec<RgbImage>,
) -> Result<Vec<OAROCRResult>, OCRError>
pub fn predict( &self, images: Vec<RgbImage>, ) -> Result<Vec<OAROCRResult>, OCRError>
Predicts text from images using the configured OCR pipeline.
This method orchestrates the execution of all configured tasks in the pipeline, including optional components like document orientation, rectification, and text line orientation classification.
§Arguments
images- Collection of RGB images to process
§Returns
A vector of OAROCRResult containing the OCR results for each image,
or an error if processing fails.
§Example
use oar_ocr::oarocr::ocr::OAROCRBuilder;
use oar_ocr::utils::load_image;
use std::path::Path;
let ocr = OAROCRBuilder::new(
"models/det.onnx",
"models/rec.onnx",
"models/dict.txt",
).build()?;
let image = load_image(Path::new("document.jpg"))?;
let results = ocr.predict(vec![image])?;
for result in results {
for region in result.text_regions {
if let Some(text) = region.text {
println!("Text: {}", text);
}
}
}Trait Implementations§
Auto Trait Implementations§
impl !Freeze for OAROCR
impl RefUnwindSafe for OAROCR
impl Send for OAROCR
impl Sync for OAROCR
impl Unpin for OAROCR
impl UnsafeUnpin for OAROCR
impl UnwindSafe for OAROCR
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.