pub struct OCRBeamSearchDecoder { /* private fields */ }
Expand description
OCRBeamSearchDecoder class provides an interface for OCR using Beam Search algorithm.
Note:
- (C++) An example on using OCRBeamSearchDecoder recognition combined with scene text detection can be found at the demo sample: https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/word_recognition.cpp
Implementations§
Source§impl OCRBeamSearchDecoder
impl OCRBeamSearchDecoder
Sourcepub fn default() -> OCRBeamSearchDecoder
pub fn default() -> OCRBeamSearchDecoder
Creates a default instance of the class by calling the default constructor
Sourcepub fn create(
classifier: Ptr<OCRBeamSearchDecoder_ClassifierCallback>,
vocabulary: &str,
transition_probabilities_table: &impl ToInputArray,
emission_probabilities_table: &impl ToInputArray,
mode: decoder_mode,
beam_size: i32,
) -> Result<Ptr<OCRBeamSearchDecoder>>
pub fn create( classifier: Ptr<OCRBeamSearchDecoder_ClassifierCallback>, vocabulary: &str, transition_probabilities_table: &impl ToInputArray, emission_probabilities_table: &impl ToInputArray, mode: decoder_mode, beam_size: i32, ) -> Result<Ptr<OCRBeamSearchDecoder>>
Creates an instance of the OCRBeamSearchDecoder 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).
-
beam_size: Size of the beam in Beam Search algorithm.
§C++ default parameters
- mode: OCR_DECODER_VITERBI
- beam_size: 500
Sourcepub fn create_from_file(
filename: &str,
vocabulary: &str,
transition_probabilities_table: &impl ToInputArray,
emission_probabilities_table: &impl ToInputArray,
mode: decoder_mode,
beam_size: i32,
) -> Result<Ptr<OCRBeamSearchDecoder>>
pub fn create_from_file( filename: &str, vocabulary: &str, transition_probabilities_table: &impl ToInputArray, emission_probabilities_table: &impl ToInputArray, mode: decoder_mode, beam_size: i32, ) -> Result<Ptr<OCRBeamSearchDecoder>>
Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder from the specified path.
Creates an instance of the OCRBeamSearchDecoder 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).
-
beam_size: Size of the beam in Beam Search algorithm.
§Overloaded parameters
§C++ default parameters
- mode: OCR_DECODER_VITERBI
- beam_size: 500
Sourcepub fn create_from_file_def(
filename: &str,
vocabulary: &str,
transition_probabilities_table: &impl ToInputArray,
emission_probabilities_table: &impl ToInputArray,
) -> Result<Ptr<OCRBeamSearchDecoder>>
pub fn create_from_file_def( filename: &str, vocabulary: &str, transition_probabilities_table: &impl ToInputArray, emission_probabilities_table: &impl ToInputArray, ) -> Result<Ptr<OCRBeamSearchDecoder>>
Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder from the specified path.
@overload
§Note
This alternative version of OCRBeamSearchDecoder::create_from_file function uses the following default values for its arguments:
- mode: OCR_DECODER_VITERBI
- beam_size: 500
Trait Implementations§
Source§impl BaseOCRTrait for OCRBeamSearchDecoder
impl BaseOCRTrait for OCRBeamSearchDecoder
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 OCRBeamSearchDecoder
impl BaseOCRTraitConst for OCRBeamSearchDecoder
fn as_raw_BaseOCR(&self) -> *const c_void
Source§impl Boxed for OCRBeamSearchDecoder
impl Boxed for OCRBeamSearchDecoder
Source§unsafe fn from_raw(
ptr: <OCRBeamSearchDecoder as OpenCVFromExtern>::ExternReceive,
) -> Self
unsafe fn from_raw( ptr: <OCRBeamSearchDecoder as OpenCVFromExtern>::ExternReceive, ) -> Self
Source§fn into_raw(
self,
) -> <OCRBeamSearchDecoder as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw( self, ) -> <OCRBeamSearchDecoder as OpenCVTypeExternContainer>::ExternSendMut
Source§fn as_raw(
&self,
) -> <OCRBeamSearchDecoder as OpenCVTypeExternContainer>::ExternSend
fn as_raw( &self, ) -> <OCRBeamSearchDecoder as OpenCVTypeExternContainer>::ExternSend
Source§fn as_raw_mut(
&mut self,
) -> <OCRBeamSearchDecoder as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <OCRBeamSearchDecoder as OpenCVTypeExternContainer>::ExternSendMut
Source§impl Debug for OCRBeamSearchDecoder
impl Debug for OCRBeamSearchDecoder
Source§impl Default for OCRBeamSearchDecoder
impl Default for OCRBeamSearchDecoder
Source§impl Drop for OCRBeamSearchDecoder
impl Drop for OCRBeamSearchDecoder
Source§impl From<OCRBeamSearchDecoder> for BaseOCR
impl From<OCRBeamSearchDecoder> for BaseOCR
Source§fn from(s: OCRBeamSearchDecoder) -> Self
fn from(s: OCRBeamSearchDecoder) -> Self
Source§impl OCRBeamSearchDecoderTrait for OCRBeamSearchDecoder
impl OCRBeamSearchDecoderTrait for OCRBeamSearchDecoder
fn as_raw_mut_OCRBeamSearchDecoder(&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 OCRBeamSearchDecoderTraitConst for OCRBeamSearchDecoder
impl OCRBeamSearchDecoderTraitConst for OCRBeamSearchDecoder
fn as_raw_OCRBeamSearchDecoder(&self) -> *const c_void
Source§impl TryFrom<BaseOCR> for OCRBeamSearchDecoder
impl TryFrom<BaseOCR> for OCRBeamSearchDecoder
impl Send for OCRBeamSearchDecoder
Auto Trait Implementations§
impl Freeze for OCRBeamSearchDecoder
impl RefUnwindSafe for OCRBeamSearchDecoder
impl !Sync for OCRBeamSearchDecoder
impl Unpin for OCRBeamSearchDecoder
impl UnwindSafe for OCRBeamSearchDecoder
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 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