opencv::prelude

Trait OCRTesseractTrait

Source
pub trait OCRTesseractTrait: BaseOCRTrait + OCRTesseractTraitConst {
    // Required method
    fn as_raw_mut_OCRTesseract(&mut self) -> *mut c_void;

    // Provided methods
    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_def(
        &mut self,
        image: &mut impl MatTrait,
        output_text: &mut String,
    ) -> 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<()> { ... }
    fn run_multiple_mask_def(
        &mut self,
        image: &mut impl MatTrait,
        mask: &mut impl MatTrait,
        output_text: &mut String,
    ) -> Result<()> { ... }
    fn run(
        &mut self,
        image: &impl ToInputArray,
        min_confidence: i32,
        component_level: i32,
    ) -> Result<String> { ... }
    fn run_def(
        &mut self,
        image: &impl ToInputArray,
        min_confidence: i32,
    ) -> Result<String> { ... }
    fn run_mask(
        &mut self,
        image: &impl ToInputArray,
        mask: &impl ToInputArray,
        min_confidence: i32,
        component_level: i32,
    ) -> Result<String> { ... }
    fn run_mask_def(
        &mut self,
        image: &impl ToInputArray,
        mask: &impl ToInputArray,
        min_confidence: i32,
    ) -> Result<String> { ... }
    fn set_white_list(&mut self, char_whitelist: &str) -> Result<()> { ... }
}
Expand description

Mutable methods for crate::text::OCRTesseract

Required Methods§

Provided Methods§

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<()>

Recognize text using the tesseract-ocr API.

Takes image on input and returns recognized text in the output_text parameter. Optionally provides also the Rects for individual text elements found (e.g. words), and the list of those text elements with their confidence values.

§Parameters
  • image: Input image CV_8UC1 or CV_8UC3
  • output_text: Output text of the tesseract-ocr.
  • component_rects: If provided the method will output a list of Rects for the individual text elements found (e.g. words or text lines).
  • component_texts: If provided the method will output a list of text strings for the recognition of individual text elements found (e.g. words or text lines).
  • component_confidences: If provided the method will output a list of confidence values for the recognition of individual text elements found (e.g. words or text lines).
  • component_level: OCR_LEVEL_WORD (by default), or OCR_LEVEL_TEXTLINE.
§C++ default parameters
  • component_rects: NULL
  • component_texts: NULL
  • component_confidences: NULL
  • component_level: 0
Source

fn run_multiple_def( &mut self, image: &mut impl MatTrait, output_text: &mut String, ) -> Result<()>

Recognize text using the tesseract-ocr API.

Takes image on input and returns recognized text in the output_text parameter. Optionally provides also the Rects for individual text elements found (e.g. words), and the list of those text elements with their confidence values.

§Parameters
  • image: Input image CV_8UC1 or CV_8UC3
  • output_text: Output text of the tesseract-ocr.
  • component_rects: If provided the method will output a list of Rects for the individual text elements found (e.g. words or text lines).
  • component_texts: If provided the method will output a list of text strings for the recognition of individual text elements found (e.g. words or text lines).
  • component_confidences: If provided the method will output a list of confidence values for the recognition of individual text elements found (e.g. words or text lines).
  • component_level: OCR_LEVEL_WORD (by default), or OCR_LEVEL_TEXTLINE.
§Note

This alternative version of OCRTesseractTrait::run_multiple function uses the following default values for its arguments:

  • component_rects: NULL
  • component_texts: NULL
  • component_confidences: NULL
  • component_level: 0
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<()>

§C++ default parameters
  • component_rects: NULL
  • component_texts: NULL
  • component_confidences: NULL
  • component_level: 0
Source

fn run_multiple_mask_def( &mut self, image: &mut impl MatTrait, mask: &mut impl MatTrait, output_text: &mut String, ) -> Result<()>

§Note

This alternative version of OCRTesseractTrait::run_multiple_mask function uses the following default values for its arguments:

  • component_rects: NULL
  • component_texts: NULL
  • component_confidences: NULL
  • component_level: 0
Source

fn run( &mut self, image: &impl ToInputArray, min_confidence: i32, component_level: i32, ) -> Result<String>

§C++ default parameters
  • component_level: 0
Source

fn run_def( &mut self, image: &impl ToInputArray, min_confidence: i32, ) -> Result<String>

§Note

This alternative version of OCRTesseractTrait::run function uses the following default values for its arguments:

  • component_level: 0
Source

fn run_mask( &mut self, image: &impl ToInputArray, mask: &impl ToInputArray, min_confidence: i32, component_level: i32, ) -> Result<String>

§C++ default parameters
  • component_level: 0
Source

fn run_mask_def( &mut self, image: &impl ToInputArray, mask: &impl ToInputArray, min_confidence: i32, ) -> Result<String>

§Note

This alternative version of OCRTesseractTrait::run_mask function uses the following default values for its arguments:

  • component_level: 0
Source

fn set_white_list(&mut self, char_whitelist: &str) -> Result<()>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§