pub struct OcrConfig {
pub render_dpi: u32,
pub trigger: OcrTrigger,
pub min_text_length: usize,
pub min_confidence: f32,
}Expand description
OCR 处理器配置。
控制渲染 DPI、OCR 触发条件和质量阈值。
§Examples
use easypdf_markdown::ocr::{OcrConfig, OcrTrigger};
let config = OcrConfig {
render_dpi: 300,
trigger: OcrTrigger::Always,
min_confidence: 0.8,
..OcrConfig::default()
};
assert_eq!(config.render_dpi, 300);Fields§
§render_dpi: u32页面转图像的渲染 DPI。默认值:200。
值越高 OCR 准确度越好,但内存占用和处理时间也越大。 200 DPI 对大多数文档是较好的平衡点。
trigger: OcrTriggerOCR 触发条件。默认值:OcrTrigger::OnEmptyPage。
min_text_length: usize从 OCR 结果中保留的最小文本长度。默认值:0(全部保留)。
短于此阈值的 OCR 结果将被视为噪声而丢弃。
min_confidence: f32最小置信度阈值。默认值:0.5。
置信度低于此值的 OCR 结果将生成警告。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OcrConfig
impl RefUnwindSafe for OcrConfig
impl Send for OcrConfig
impl Sync for OcrConfig
impl Unpin for OcrConfig
impl UnsafeUnpin for OcrConfig
impl UnwindSafe for OcrConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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,
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