pixGetPixels: Get and Set the Pixels in a Pix Object

View source: R/leptonica.R

pixGetPixelsR Documentation

Get and Set the Pixels in a Pix Object

Description

These functions allow us to query and set all of the pixels in a Pix-class image. The image may be either a gray-scale (including binary) or an RGB image.

Usage

pixGetPixels(pix, dims = pixGetDims(pix), transpose = FALSE)

Arguments

pix

a Pix-class object

dims

the dimensions of the Pix-class object

transpose

a logical value controlling whether the dimensions of the resulting matrix are reversed, i.e., the number of rows and columns are interchanged.

Value

pixGetPixels returns a matrix.

pixGetRGBPixels returns a 3-dimensional array with rows, columns and depth corresponding to the height of the image, the width of the image, and the three color channels, Red, Green and Blue.

Author(s)

Duncan Temple Lang

References

http://tpgit.github.io/UnOfficialLeptDocs/

See Also

pixRead GetInputImage pixAnd

Examples

  f = system.file("images", "DifferentFonts.png", package = "Rtesseract")
  p = pixRead(f)
  m = pixGetPixels(p)
  m = p[,]

  p2 = pixConvertTo8(p)
  m2 = p[,]

  a = pixGetRGBPixels(p)
  dim(a)

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