pub struct TextRecognitionModel { /* private fields */ }
Expand description
This class represents high-level API for text recognition networks.
TextRecognitionModel allows to set params for preprocessing input image. TextRecognitionModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and return recognition result. For TextRecognitionModel, CRNN-CTC is supported.
Implementations§
Source§impl TextRecognitionModel
impl TextRecognitionModel
pub fn default() -> Result<TextRecognitionModel>
Sourcepub fn new(network: &impl NetTraitConst) -> Result<TextRecognitionModel>
pub fn new(network: &impl NetTraitConst) -> Result<TextRecognitionModel>
Create Text Recognition model from deep learning network Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
§Parameters
- network: Net object
Sourcepub fn from_file(model: &str, config: &str) -> Result<TextRecognitionModel>
pub fn from_file(model: &str, config: &str) -> Result<TextRecognitionModel>
Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
§Parameters
- model: Binary file contains trained weights
- config: Text file contains network configuration
§C++ default parameters
- config: “”
Sourcepub fn from_file_def(model: &str) -> Result<TextRecognitionModel>
pub fn from_file_def(model: &str) -> Result<TextRecognitionModel>
Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
§Parameters
- model: Binary file contains trained weights
- config: Text file contains network configuration
§Note
This alternative version of [from_file] function uses the following default values for its arguments:
- config: “”
Trait Implementations§
Source§impl Boxed for TextRecognitionModel
impl Boxed for TextRecognitionModel
Source§unsafe fn from_raw(
ptr: <TextRecognitionModel as OpenCVFromExtern>::ExternReceive,
) -> Self
unsafe fn from_raw( ptr: <TextRecognitionModel as OpenCVFromExtern>::ExternReceive, ) -> Self
Source§fn into_raw(
self,
) -> <TextRecognitionModel as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw( self, ) -> <TextRecognitionModel as OpenCVTypeExternContainer>::ExternSendMut
Source§fn as_raw(
&self,
) -> <TextRecognitionModel as OpenCVTypeExternContainer>::ExternSend
fn as_raw( &self, ) -> <TextRecognitionModel as OpenCVTypeExternContainer>::ExternSend
Source§fn as_raw_mut(
&mut self,
) -> <TextRecognitionModel as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <TextRecognitionModel as OpenCVTypeExternContainer>::ExternSendMut
Source§impl Clone for TextRecognitionModel
impl Clone for TextRecognitionModel
Source§impl Debug for TextRecognitionModel
impl Debug for TextRecognitionModel
Source§impl Drop for TextRecognitionModel
impl Drop for TextRecognitionModel
Source§impl From<TextRecognitionModel> for Model
impl From<TextRecognitionModel> for Model
Source§fn from(s: TextRecognitionModel) -> Self
fn from(s: TextRecognitionModel) -> Self
Source§impl ModelTrait for TextRecognitionModel
impl ModelTrait for TextRecognitionModel
fn as_raw_mut_Model(&mut self) -> *mut c_void
fn set(&mut self, unnamed: &impl ModelTraitConst)
fn set_1(&mut self, unnamed: Model)
Source§fn set_input_size_1(&mut self, width: i32, height: i32) -> Result<Model>
fn set_input_size_1(&mut self, width: i32, height: i32) -> Result<Model>
Source§fn set_input_mean(&mut self, mean: Scalar) -> Result<Model>
fn set_input_mean(&mut self, mean: Scalar) -> Result<Model>
Source§fn set_input_scale(&mut self, scale: Scalar) -> Result<Model>
fn set_input_scale(&mut self, scale: Scalar) -> Result<Model>
Source§fn set_input_swap_rb(&mut self, swap_rb: bool) -> Result<Model>
fn set_input_swap_rb(&mut self, swap_rb: bool) -> Result<Model>
Source§fn set_output_names(&mut self, out_names: &Vector<String>) -> Result<Model>
fn set_output_names(&mut self, out_names: &Vector<String>) -> Result<Model>
Source§fn set_input_params(
&mut self,
scale: f64,
size: Size,
mean: Scalar,
swap_rb: bool,
crop: bool,
) -> Result<()>
fn set_input_params( &mut self, scale: f64, size: Size, mean: Scalar, swap_rb: bool, crop: bool, ) -> Result<()>
Source§fn set_input_params_def(&mut self) -> Result<()>
fn set_input_params_def(&mut self) -> Result<()>
fn get_network__1(&mut self) -> Result<Net>
Source§impl ModelTraitConst for TextRecognitionModel
impl ModelTraitConst for TextRecognitionModel
fn as_raw_Model(&self) -> *const c_void
Source§fn predict(
&self,
frame: &impl ToInputArray,
outs: &mut impl ToOutputArray,
) -> Result<()>
fn predict( &self, frame: &impl ToInputArray, outs: &mut impl ToOutputArray, ) -> Result<()>
fn get_network_(&self) -> Result<Net>
Source§impl TextRecognitionModelTrait for TextRecognitionModel
impl TextRecognitionModelTrait for TextRecognitionModel
fn as_raw_mut_TextRecognitionModel(&mut self) -> *mut c_void
Source§fn set_decode_type(&mut self, decode_type: &str) -> Result<TextRecognitionModel>
fn set_decode_type(&mut self, decode_type: &str) -> Result<TextRecognitionModel>
Source§fn set_decode_opts_ctc_prefix_beam_search(
&mut self,
beam_size: i32,
voc_prune_size: i32,
) -> Result<TextRecognitionModel>
fn set_decode_opts_ctc_prefix_beam_search( &mut self, beam_size: i32, voc_prune_size: i32, ) -> Result<TextRecognitionModel>
"CTC-prefix-beam-search"
decode usage Read moreSource§fn set_decode_opts_ctc_prefix_beam_search_def(
&mut self,
beam_size: i32,
) -> Result<TextRecognitionModel>
fn set_decode_opts_ctc_prefix_beam_search_def( &mut self, beam_size: i32, ) -> Result<TextRecognitionModel>
"CTC-prefix-beam-search"
decode usage Read moreSource§fn set_vocabulary(
&mut self,
vocabulary: &Vector<String>,
) -> Result<TextRecognitionModel>
fn set_vocabulary( &mut self, vocabulary: &Vector<String>, ) -> Result<TextRecognitionModel>
Source§impl TextRecognitionModelTraitConst for TextRecognitionModel
impl TextRecognitionModelTraitConst for TextRecognitionModel
fn as_raw_TextRecognitionModel(&self) -> *const c_void
Source§fn get_vocabulary(&self) -> Result<Vector<String>>
fn get_vocabulary(&self) -> Result<Vector<String>>
Source§fn recognize(&self, frame: &impl ToInputArray) -> Result<String>
fn recognize(&self, frame: &impl ToInputArray) -> Result<String>
Source§fn recognize_1(
&self,
frame: &impl ToInputArray,
roi_rects: &impl ToInputArray,
results: &mut Vector<String>,
) -> Result<()>
fn recognize_1( &self, frame: &impl ToInputArray, roi_rects: &impl ToInputArray, results: &mut Vector<String>, ) -> Result<()>
impl Send for TextRecognitionModel
Auto Trait Implementations§
impl Freeze for TextRecognitionModel
impl RefUnwindSafe for TextRecognitionModel
impl !Sync for TextRecognitionModel
impl Unpin for TextRecognitionModel
impl UnwindSafe for TextRecognitionModel
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
Source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res,
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res
Mat
or another similar object. By passing
a mutable reference to the Mat
to this function your closure will get called with the read reference and a write references
to the same Mat
. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold
. Read more