Struct tesseract_plumbing::TessBaseAPI[][src]

pub struct TessBaseAPI(_);

Wrapper around tesseract::TessBaseAPI

Implementations

impl TessBaseAPI[src]

pub fn create() -> TessBaseAPI[src]

pub fn init_2(
    &mut self,
    datapath: Option<&CStr>,
    language: Option<&CStr>
) -> Result<(), TessBaseAPIInitError>
[src]

Wrapper for Init-2

Start tesseract

pub fn set_image_2(&mut self, pix: &Pix)[src]

Wrapper for SetImage-2

pub fn set_image(
    &mut self,
    image_data: &[u8],
    width: c_int,
    height: c_int,
    bytes_per_pixel: c_int,
    bytes_per_line: c_int
) -> Result<(), TessBaseAPISetImageSafetyError>
[src]

Wrapper for SetImage-1

pub fn set_source_resolution(&mut self, ppi: c_int)[src]

Wrapper for SetSourceResolution

Set the resolution of the source image in pixels per inch so font size information can be calculated in results. Call this after SetImage().

pub fn set_variable(
    &mut self,
    name: &CStr,
    value: &CStr
) -> Result<(), TessBaseAPISetVariableError>
[src]

Wrapper for SetVariable

Warning! Everytime you use a name that isn’t recognized by Tesseract, a few bytes of memory are leaked.

pub fn recognize(&mut self) -> Result<(), TessBaseAPIRecogniseError>[src]

Wrapper for Recognize

Recognize the image. Returns Ok(()) on success and Err(()) otherwise. It is currently unclear to me what would make it error.

It could take a progress argument (monitor). If there is appetite for this, let me know and I could try and implement it.

pub fn get_utf8_text(&mut self) -> Result<Text, TessBaseAPIGetUTF8TextError>[src]

Wrapper for GetUTF8Text

Get the text out of an image.

Can return an error (null pointer), but it is not clear to me what would cause this.

This will implicitly call recognize if required.

pub fn get_hocr_text(
    &mut self,
    page: c_int
) -> Result<Text, TessBaseAPIGetHOCRTextError>
[src]

Wrapper for GetUTF8Text

Get the text out of an image.

Can return an error (null pointer), but it is not clear to me what would cause this.

This will implicitly call recognize if required.

pub fn get_input_image(&self) -> Option<BorrowedPix<'_>>[src]

pub fn get_source_y_resolution(&self) -> c_int[src]

pub fn set_rectangle(
    &mut self,
    left: c_int,
    top: c_int,
    width: c_int,
    height: c_int
)
[src]

Wrapper for TessBaseAPISetRectangle

Restrict recognition to a sub-rectangle of the image. Call after SetImage. Each SetRectangle clears the recogntion results so multiple rectangles can be recognized with the same image.

pub fn get_alto_text(
    &mut self,
    page_number: c_int
) -> Result<Text, TessBaseAPIGetAltoTextError>
[src]

Wrapper for TessBaseAPIGetAltoText

Make an XML-formatted string with Alto markup from the internal data structures.

pub fn get_tsv_text(
    &mut self,
    page_number: c_int
) -> Result<Text, TessBaseAPIGetTsvTextError>
[src]

Wrapper for TessBaseAPIGetTsvText

Make a TSV-formatted string from the internal data structures. page_number is 0-based but will appear in the output as 1-based.

pub fn get_lstm_box_text(
    &mut self,
    page_number: c_int
) -> Result<Text, TessBaseAPIGetLSTMBoxTextError>
[src]

Wrapper for TessBaseAPIGetLSTMBoxText

Make a box file for LSTM training from the internal data structures. Constructs coordinates in the original image - not just the rectangle. page_number is a 0-based page index that will appear in the box file.

pub fn get_word_str_box_text(
    &mut self,
    page_number: c_int
) -> Result<Text, TessBaseAPIGetWordStrBoxTextError>
[src]

Wrapper for TessBaseAPIGetWordStrBoxText

The recognized text is returned as a char* which is coded in the same format as a WordStr box file used in training. page_number is a 0-based page index that will appear in the box file. Returned string must be freed with the delete [] operator.

Create a UTF8 box file with WordStr strings from the internal data structures. page_number is a 0-base page index that will appear in the box file.

pub fn mean_text_conf(&self) -> c_int[src]

Wrapper for TessBaseAPIMeanTextConf

Returns the (average) confidence value between 0 and 100.

Returns the average word confidence for Tesseract page result.

Trait Implementations

impl Debug for TessBaseAPI[src]

impl Default for TessBaseAPI[src]

impl Drop for TessBaseAPI[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.