pub struct DocUnwarper {
pub enabled: bool,
/* private fields */
}Expand description
Wrapper ONNX per UVDoc document unwarping.
Fields§
§enabled: boolAbilita la rettificazione. Default false: quando disabilitato
[unwarp] restituisce l’immagine originale invariata senza alcuna
inferenza. Impostare a true solo su documenti fotografati/distorti.
Implementations§
Source§impl DocUnwarper
impl DocUnwarper
Sourcepub fn from_path(model_path: impl AsRef<Path>) -> Result<Self, OcrError>
pub fn from_path(model_path: impl AsRef<Path>) -> Result<Self, OcrError>
Carica il modello da file.
L’ONNX ha shape dinamica: accetta l’immagine a qualsiasi risoluzione e restituisce output alle stesse dimensioni. Il backbone interno opera a ~488×712 indipendentemente dalla risoluzione passata.
Sourcepub fn from_session(session: Session) -> Self
pub fn from_session(session: Session) -> Self
Costruttore da Session pre-caricata.
Sourcepub fn unwarp(&self, image: &RgbImage) -> Result<UnwarpResult, OcrError>
pub fn unwarp(&self, image: &RgbImage) -> Result<UnwarpResult, OcrError>
Rettifica un’immagine documento distorta.
Se self.enabled == false (default) restituisce l’immagine originale
clonata senza eseguire alcuna inferenza.
L’immagine di output ha le stesse dimensioni dell’input originale: il modello riduce internamente a ~488×712 per l’estrazione features, poi upsampling la griglia alle dimensioni originali e applica il grid_sample sull’immagine originale ad alta risoluzione.
Auto Trait Implementations§
impl !RefUnwindSafe for DocUnwarper
impl !UnwindSafe for DocUnwarper
impl Freeze for DocUnwarper
impl Send for DocUnwarper
impl Sync for DocUnwarper
impl Unpin for DocUnwarper
impl UnsafeUnpin for DocUnwarper
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
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>
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 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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.