Struct tesseract_plumbing::TessBaseAPI [−][src]
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]
&mut self,
datapath: Option<&CStr>,
language: Option<&CStr>
) -> Result<(), TessBaseAPIInitError>
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]
&mut self,
image_data: &[u8],
width: c_int,
height: c_int,
bytes_per_pixel: c_int,
bytes_per_line: c_int
) -> Result<(), TessBaseAPISetImageSafetyError>
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]
&mut self,
name: &CStr,
value: &CStr
) -> Result<(), TessBaseAPISetVariableError>
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]
&mut self,
page: c_int
) -> Result<Text, TessBaseAPIGetHOCRTextError>
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]
Wrapper for TessBaseAPIGetInputImage
pub fn get_source_y_resolution(&self) -> c_int
[src]
Wrapper for TessBaseAPIGetSourceYResolution
pub fn set_rectangle(
&mut self,
left: c_int,
top: c_int,
width: c_int,
height: c_int
)
[src]
&mut self,
left: c_int,
top: c_int,
width: c_int,
height: c_int
)
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]
&mut self,
page_number: c_int
) -> Result<Text, TessBaseAPIGetAltoTextError>
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]
&mut self,
page_number: c_int
) -> Result<Text, TessBaseAPIGetTsvTextError>
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]
&mut self,
page_number: c_int
) -> Result<Text, TessBaseAPIGetLSTMBoxTextError>
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]
&mut self,
page_number: c_int
) -> Result<Text, TessBaseAPIGetWordStrBoxTextError>
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
Auto Trait Implementations
impl RefUnwindSafe for TessBaseAPI
impl !Send for TessBaseAPI
impl !Sync for TessBaseAPI
impl Unpin for TessBaseAPI
impl UnwindSafe for TessBaseAPI
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,