[][src]Struct leptess::tesseract::TessApi

pub struct TessApi {
    pub raw: *mut TessBaseAPI,
    // some fields omitted
}

Fields

raw: *mut TessBaseAPI

Implementations

impl TessApi[src]

pub fn new<'a>(
    data_path: Option<&'a str>,
    lang: &'a str
) -> Result<TessApi, TessInitError>
[src]

pub fn set_image(&mut self, img: &Pix)[src]

Provide an image for Tesseract to recognize.

set_image clears all recognition results, and sets the rectangle to the full image, so it may be followed immediately by a [Self::get_utf8_text], and it will automatically perform recognition.

pub fn get_image_dimensions(&self) -> Option<(u32, u32)>[src]

Get the dimensions of the currently loaded image, or None if no image is loaded.

Example

let path = std::path::Path::new("tests/di.png");
let img = leptess::leptonica::pix_read(&path).unwrap();
 
let mut tes = leptess::tesseract::TessApi::new(Some("tests/tessdata"), "eng").unwrap();
tes.set_image(&img);
 
assert_eq!(tes.get_image_dimensions(), Some((442, 852)));

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

pub fn set_source_resolution(&mut self, res: i32)[src]

Override image resolution. Can be used to suppress "Warning: Invalid resolution 0 dpi." output.

pub fn recognize(&self) -> i32[src]

pub fn set_rectangle(&mut self, b: &Box)[src]

pub fn get_utf8_text(&self) -> Result<String, Utf8Error>[src]

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

pub fn get_regions(&self) -> Option<Boxa>[src]

pub fn get_component_images(
    &self,
    level: TessPageIteratorLevel,
    text_only: bool
) -> Option<Boxa>
[src]

Get the given level kind of components (block, textline, word etc.) as a leptonica-style Boxa, in reading order.If text_only is true, then only text components are returned.

Trait Implementations

impl Debug for TessApi[src]

impl Drop for TessApi[src]

impl PartialEq<TessApi> for TessApi[src]

impl StructuralPartialEq for TessApi[src]

Auto Trait Implementations

impl RefUnwindSafe for TessApi

impl !Send for TessApi

impl !Sync for TessApi

impl Unpin for TessApi

impl UnwindSafe for TessApi

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.