Struct opencv::text::OCRHMMDecoder
source · pub struct OCRHMMDecoder { /* private fields */ }
Expand description
OCRHMMDecoder class provides an interface for OCR using Hidden Markov Models.
Note:
- (C++) An example on using OCRHMMDecoder recognition combined with scene text detection can be found at the webcam_demo sample: https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/webcam_demo.cpp
Implementations§
source§impl OCRHMMDecoder
impl OCRHMMDecoder
sourcepub fn create(
classifier: Ptr<OCRHMMDecoder_ClassifierCallback>,
vocabulary: &str,
transition_probabilities_table: &impl ToInputArray,
emission_probabilities_table: &impl ToInputArray,
mode: i32
) -> Result<Ptr<OCRHMMDecoder>>
pub fn create( classifier: Ptr<OCRHMMDecoder_ClassifierCallback>, vocabulary: &str, transition_probabilities_table: &impl ToInputArray, emission_probabilities_table: &impl ToInputArray, mode: i32 ) -> Result<Ptr<OCRHMMDecoder>>
Creates an instance of the OCRHMMDecoder class. Initializes HMMDecoder.
§Parameters
-
classifier: The character classifier with built in feature extractor.
-
vocabulary: The language vocabulary (chars when ascii english text). vocabulary.size() must be equal to the number of classes of the classifier.
-
transition_probabilities_table: Table with transition probabilities between character pairs. cols == rows == vocabulary.size().
-
emission_probabilities_table: Table with observation emission probabilities. cols == rows == vocabulary.size().
-
mode: HMM Decoding algorithm. Only OCR_DECODER_VITERBI is available for the moment (http://en.wikipedia.org/wiki/Viterbi_algorithm).
§C++ default parameters
- mode: OCR_DECODER_VITERBI
sourcepub fn create_def(
classifier: Ptr<OCRHMMDecoder_ClassifierCallback>,
vocabulary: &str,
transition_probabilities_table: &impl ToInputArray,
emission_probabilities_table: &impl ToInputArray
) -> Result<Ptr<OCRHMMDecoder>>
pub fn create_def( classifier: Ptr<OCRHMMDecoder_ClassifierCallback>, vocabulary: &str, transition_probabilities_table: &impl ToInputArray, emission_probabilities_table: &impl ToInputArray ) -> Result<Ptr<OCRHMMDecoder>>
Creates an instance of the OCRHMMDecoder class. Initializes HMMDecoder.
§Parameters
-
classifier: The character classifier with built in feature extractor.
-
vocabulary: The language vocabulary (chars when ascii english text). vocabulary.size() must be equal to the number of classes of the classifier.
-
transition_probabilities_table: Table with transition probabilities between character pairs. cols == rows == vocabulary.size().
-
emission_probabilities_table: Table with observation emission probabilities. cols == rows == vocabulary.size().
-
mode: HMM Decoding algorithm. Only OCR_DECODER_VITERBI is available for the moment (http://en.wikipedia.org/wiki/Viterbi_algorithm).
§Note
This alternative version of OCRHMMDecoder::create function uses the following default values for its arguments:
- mode: OCR_DECODER_VITERBI
sourcepub fn create_from_file(
filename: &str,
vocabulary: &str,
transition_probabilities_table: &impl ToInputArray,
emission_probabilities_table: &impl ToInputArray,
mode: i32,
classifier: i32
) -> Result<Ptr<OCRHMMDecoder>>
pub fn create_from_file( filename: &str, vocabulary: &str, transition_probabilities_table: &impl ToInputArray, emission_probabilities_table: &impl ToInputArray, mode: i32, classifier: i32 ) -> Result<Ptr<OCRHMMDecoder>>
Creates an instance of the OCRHMMDecoder class. Loads and initializes HMMDecoder from the specified path
Creates an instance of the OCRHMMDecoder class. Initializes HMMDecoder.
§Parameters
-
classifier: The character classifier with built in feature extractor.
-
vocabulary: The language vocabulary (chars when ascii english text). vocabulary.size() must be equal to the number of classes of the classifier.
-
transition_probabilities_table: Table with transition probabilities between character pairs. cols == rows == vocabulary.size().
-
emission_probabilities_table: Table with observation emission probabilities. cols == rows == vocabulary.size().
-
mode: HMM Decoding algorithm. Only OCR_DECODER_VITERBI is available for the moment (http://en.wikipedia.org/wiki/Viterbi_algorithm).
§Overloaded parameters
§C++ default parameters
- mode: OCR_DECODER_VITERBI
- classifier: OCR_KNN_CLASSIFIER
sourcepub fn create_from_file_def(
filename: &str,
vocabulary: &str,
transition_probabilities_table: &impl ToInputArray,
emission_probabilities_table: &impl ToInputArray
) -> Result<Ptr<OCRHMMDecoder>>
pub fn create_from_file_def( filename: &str, vocabulary: &str, transition_probabilities_table: &impl ToInputArray, emission_probabilities_table: &impl ToInputArray ) -> Result<Ptr<OCRHMMDecoder>>
Creates an instance of the OCRHMMDecoder class. Loads and initializes HMMDecoder from the specified path
@overload
§Note
This alternative version of OCRHMMDecoder::create_from_file function uses the following default values for its arguments:
- mode: OCR_DECODER_VITERBI
- classifier: OCR_KNN_CLASSIFIER
Trait Implementations§
source§impl BaseOCRTrait for OCRHMMDecoder
impl BaseOCRTrait for OCRHMMDecoder
fn as_raw_mut_BaseOCR(&mut self) -> *mut c_void
source§fn run(
&mut self,
image: &mut impl MatTrait,
output_text: &mut String,
component_rects: &mut Vector<Rect>,
component_texts: &mut Vector<String>,
component_confidences: &mut Vector<f32>,
component_level: i32
) -> Result<()>
fn run( &mut self, image: &mut impl MatTrait, output_text: &mut String, component_rects: &mut Vector<Rect>, component_texts: &mut Vector<String>, component_confidences: &mut Vector<f32>, component_level: i32 ) -> Result<()>
source§fn run_def(
&mut self,
image: &mut impl MatTrait,
output_text: &mut String
) -> Result<()>
fn run_def( &mut self, image: &mut impl MatTrait, output_text: &mut String ) -> Result<()>
source§impl BaseOCRTraitConst for OCRHMMDecoder
impl BaseOCRTraitConst for OCRHMMDecoder
fn as_raw_BaseOCR(&self) -> *const c_void
source§impl Boxed for OCRHMMDecoder
impl Boxed for OCRHMMDecoder
source§unsafe fn from_raw(
ptr: <OCRHMMDecoder as OpenCVFromExtern>::ExternReceive
) -> Self
unsafe fn from_raw( ptr: <OCRHMMDecoder as OpenCVFromExtern>::ExternReceive ) -> Self
source§fn into_raw(self) -> <OCRHMMDecoder as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <OCRHMMDecoder as OpenCVTypeExternContainer>::ExternSendMut
source§fn as_raw(&self) -> <OCRHMMDecoder as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <OCRHMMDecoder as OpenCVTypeExternContainer>::ExternSend
source§fn as_raw_mut(
&mut self
) -> <OCRHMMDecoder as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self ) -> <OCRHMMDecoder as OpenCVTypeExternContainer>::ExternSendMut
source§impl Debug for OCRHMMDecoder
impl Debug for OCRHMMDecoder
source§impl Default for OCRHMMDecoder
impl Default for OCRHMMDecoder
source§impl Drop for OCRHMMDecoder
impl Drop for OCRHMMDecoder
source§impl From<OCRHMMDecoder> for BaseOCR
impl From<OCRHMMDecoder> for BaseOCR
source§fn from(s: OCRHMMDecoder) -> Self
fn from(s: OCRHMMDecoder) -> Self
source§impl OCRHMMDecoderTrait for OCRHMMDecoder
impl OCRHMMDecoderTrait for OCRHMMDecoder
fn as_raw_mut_OCRHMMDecoder(&mut self) -> *mut c_void
source§fn run_multiple(
&mut self,
image: &mut impl MatTrait,
output_text: &mut String,
component_rects: &mut Vector<Rect>,
component_texts: &mut Vector<String>,
component_confidences: &mut Vector<f32>,
component_level: i32
) -> Result<()>
fn run_multiple( &mut self, image: &mut impl MatTrait, output_text: &mut String, component_rects: &mut Vector<Rect>, component_texts: &mut Vector<String>, component_confidences: &mut Vector<f32>, component_level: i32 ) -> Result<()>
source§fn run_multiple_def(
&mut self,
image: &mut impl MatTrait,
output_text: &mut String
) -> Result<()>
fn run_multiple_def( &mut self, image: &mut impl MatTrait, output_text: &mut String ) -> Result<()>
source§fn run_multiple_mask(
&mut self,
image: &mut impl MatTrait,
mask: &mut impl MatTrait,
output_text: &mut String,
component_rects: &mut Vector<Rect>,
component_texts: &mut Vector<String>,
component_confidences: &mut Vector<f32>,
component_level: i32
) -> Result<()>
fn run_multiple_mask( &mut self, image: &mut impl MatTrait, mask: &mut impl MatTrait, output_text: &mut String, component_rects: &mut Vector<Rect>, component_texts: &mut Vector<String>, component_confidences: &mut Vector<f32>, component_level: i32 ) -> Result<()>
source§fn run_multiple_mask_def(
&mut self,
image: &mut impl MatTrait,
mask: &mut impl MatTrait,
output_text: &mut String
) -> Result<()>
fn run_multiple_mask_def( &mut self, image: &mut impl MatTrait, mask: &mut impl MatTrait, output_text: &mut String ) -> Result<()>
source§fn run(
&mut self,
image: &impl ToInputArray,
min_confidence: i32,
component_level: i32
) -> Result<String>
fn run( &mut self, image: &impl ToInputArray, min_confidence: i32, component_level: i32 ) -> Result<String>
source§fn run_def(
&mut self,
image: &impl ToInputArray,
min_confidence: i32
) -> Result<String>
fn run_def( &mut self, image: &impl ToInputArray, min_confidence: i32 ) -> Result<String>
source§fn run_mask(
&mut self,
image: &impl ToInputArray,
mask: &impl ToInputArray,
min_confidence: i32,
component_level: i32
) -> Result<String>
fn run_mask( &mut self, image: &impl ToInputArray, mask: &impl ToInputArray, min_confidence: i32, component_level: i32 ) -> Result<String>
source§fn run_mask_def(
&mut self,
image: &impl ToInputArray,
mask: &impl ToInputArray,
min_confidence: i32
) -> Result<String>
fn run_mask_def( &mut self, image: &impl ToInputArray, mask: &impl ToInputArray, min_confidence: i32 ) -> Result<String>
source§impl OCRHMMDecoderTraitConst for OCRHMMDecoder
impl OCRHMMDecoderTraitConst for OCRHMMDecoder
fn as_raw_OCRHMMDecoder(&self) -> *const c_void
source§impl TryFrom<BaseOCR> for OCRHMMDecoder
impl TryFrom<BaseOCR> for OCRHMMDecoder
impl Send for OCRHMMDecoder
Auto Trait Implementations§
impl Freeze for OCRHMMDecoder
impl RefUnwindSafe for OCRHMMDecoder
impl !Sync for OCRHMMDecoder
impl Unpin for OCRHMMDecoder
impl UnwindSafe for OCRHMMDecoder
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<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 of course unsafe as it breaks the Rust aliasing rules, but it might be useful for some performance
sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold
. Read more