pub struct Opt {
pub threshold: f32,
pub dpi: i32,
pub border: u32,
pub output: Option<PathBuf>,
pub tessdata_dir: Option<String>,
pub lang: String,
pub config: Vec<(Variable, String)>,
pub input: PathBuf,
pub dump: bool,
pub dump_raw: bool,
}
Expand description
Handle application parameter from cli with Clap.
Fields§
§threshold: f32
Threshold for subtitle image binarization.
Must be between 0.0 and 1.0. Only pixels with luminance above the threshold will be considered text pixels for OCR.
dpi: i32
DPI of subtitle images.
This setting doesn’t strictly make sense for DVD subtitles, but it can influence Tesseract’s output.
border: u32
Border in pixels to surround the each subtitle image for OCR.
This can have subtle effects on the quality of the OCR.
output: Option<PathBuf>
Output subtitle file; stdout if not present.
tessdata_dir: Option<String>
Path to Tesseract’s tessdata directory.
lang: String
The Tesseract language(s) to use for OCR.
config: Vec<(Variable, String)>
Set values for config variables.
This works like the tesseract
command’s -c
argument. One
particularly useful option is tessedit_char_blacklist=|\/
_~` or
similar, to prevent the OCR from misidentifying characters as symbols
rarely used in subtitles.
input: PathBuf
Set the path of the file to process.
dump: bool
Dump processed subtitle images into the working directory as PNG files.
dump_raw: bool
Dump raw subtitle images into the working directory as PNG files.
Trait Implementations§
Source§impl Args for Opt
impl Args for Opt
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command
so it can instantiate self
via
FromArgMatches::update_from_arg_matches_mut
Read moreSource§impl CommandFactory for Opt
impl CommandFactory for Opt
Source§impl FromArgMatches for Opt
impl FromArgMatches for Opt
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Source§impl Parser for Opt
impl Parser for Opt
Source§fn parse_from<I, T>(itr: I) -> Self
fn parse_from<I, T>(itr: I) -> Self
Source§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
Source§fn update_from<I, T>(&mut self, itr: I)
fn update_from<I, T>(&mut self, itr: I)
Auto Trait Implementations§
impl Freeze for Opt
impl RefUnwindSafe for Opt
impl Send for Opt
impl Sync for Opt
impl Unpin for Opt
impl UnwindSafe for Opt
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> 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