SetInputName: Load an Image into the Tesseract Instance

View source: R/ext.R

SetInputNameR Documentation

Load an Image into the Tesseract Instance

Description

These functions provide different ways to specify which image to perform the OCR on and also to query the name of the current image file being processed.

Usage

SetInputName(api, name, check = TRUE, load = TRUE)
GetInputName(api)
SetImage(api, pix, filename = NA) 

Arguments

api

an instance of the TesseractBaseAPI-class obtained from a call to tesseract

name

a character vector of length 1 that gives the name of the image file to be processed

check

a logical value controlling whether the value of name must identify an actual file that exists

load

a logical value indicating whether to actually read the image

pix

a Pix-class object, typically created via pixRead. This is the contents of the image.

filename

the name associated with the pix being set. If the pix was created anonymously, i.e., separately from a file, this is an opportunity to give it a name. This can occur when we read from a file and then modify the image and then pass it to SetImage.

Value

GetInputName returns a character vector of length 1 (a string) with the name of the image file that was previously loaded. This could be empty if the image was loaded directly as a Pix object.

Author(s)

Duncan Temple Lang

References

http://zdenop.github.io/tesseract-doc/classtesseract_1_1_tess_base_a_p_i.html

See Also

tesseract, GetText pixRead

Examples

f = system.file("images", "OCRSample2.png", package = "Rtesseract")
p = pixRead(f)
ts = tesseract()
GetInputName(ts) # NA
SetImage(ts, p)
GetInputName(ts) # NA
SetInputName(ts, f)
GetInputName(ts)

duncantl/Rtesseract documentation built on March 25, 2022, 5:50 a.m.