pixRotate | R Documentation |
These functions allow the caller to rotate a Pix image. This can either be done by rotating the pixels within the same rectangle, or by transposing the rows and columns of the rectangular image so that rows become columns and columns become rows. Both change the contents in a similar manner, but the resulting image has different dimensions in general.
The Flip functions reverse the order of the rows (TB) or the columns (LR). These are done quickly in leptonica rather than bringing the data back to R. These can also be done in place (i.e. modify the existing image), create a new image, or for a second image.
pixRotateAMGray(pix, angle, grayVal = 0L)
pixRotate(pix, angle = -pi/2, type = 1L, incolor = 1L, width = 0L, height = 0L)
pixFlipLR(pix, target = NULL)
pixFlipTB(pix, target = NULL)
pix |
the Pix object created via |
angle |
a numeric value specifying the angle of rotation. These are in radians. Positive values are clockwise, negative values anti-clockwise |
grayVal |
an integer value specifying the .... |
type |
how to rotate - by area map, shear or sampling |
incolor |
whether to bring in white or black pixels the rotation leaves uncovered space from the background. |
width , height |
ignore for now, i.e. leave as 0 |
target |
either a Pix object or NULL. If this is |
A new Pix object.
In the future, we may allow the caller to do some of these operations in place, i.e. to modify the input image.
Duncan Temple Lang
Leptonica http://leptonica.com/ Tesseract https://code.google.com/p/tesseract-ocr/
pixRead
f = system.file("images", "SMITHBURN_1952_p3.png", package = "Rtesseract")
px = pixRead(f)
par(mfrow = c(2, 2))
plot(px)
pr = pixRotate(px)
plot(pr)
# Here we flip the rows and columns of the image.
# The result is that we have the "correct" dimensions for the new image
# For the rotated image, the dimensions remain unchanged from the
# original image.
pt = pixTranspose(px)
plot(pt)
# We reverse the order of the columns.
pth = pixTranspose(px, horiz = TRUE)
plot(pth)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.