GetImageInfo | R Documentation |
These methods provide information about the current image being processed by a tesseract OCR instance. We can query the dimensions of the image (rows, columns and depth) and also information about the samples per pixel, x and y resolution (not pixels), the format and the color depth.
GetImageInfo(obj, ...)
GetImageDims(obj, ...)
obj |
an object of class
|
... |
additional arguments for future methods |
GetImageInfo
returns a numeric vector with 5 elements.
samplesPerPixel |
|
xres |
|
yres |
|
informat |
|
colorDepth |
GetImageDims
returns a numeric vector with 3 elements.
height |
the number of rows |
width |
the number of columns |
depth |
the number of "planes" in the image |
In either case, if there is no image, the method returns NULL
.
It is possible to pass a
Pix-class
object as the value of obj
in these functions.
One can obtain the Pix-class
object via
a call to the unexported SetImage
or GetImage
,
or alternatively, via pixRead
.
If one obtains the Pix-class
instance from
a tesseract instance, it is only valid
as long as the corresponding tesseract object is valid and not garbage collected.
In other words, if you obtain the image and then remove
the references to the tesseract object, you should not use the
image object.
Duncan Temple Lang
Tesseract API Documentation.
tesseract
SetImage
f = system.file("images", "DifferentFonts.png", package = "Rtesseract")
ts = tesseract(f)
GetImageDims(ts)
GetImageInfo(ts)
## Not run:
# Don't get the Pix object this way.
pix = GetInputImage(ts, FALSE)
GetImageDims(pix)
GetImageInfo(pix)
rm(pix)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.