| RGBImage {R.image} | R Documentation |
Package: R.image
Class RGBImage
Object
~~|
~~+--BitmapImage
~~~~~~~|
~~~~~~~+--RGBImage
Directly known subclasses:
public static class RGBImage
extends BitmapImage
The RGBImage class provides methods to read, write and display images in the RGB file format.
RGBImage(R=NULL, G=NULL, B=NULL, ndim=3)
R,G,B |
Three numeric NxK matrix for the red, the green, and
the blue channel, respectively. |
ndim |
The number of dimension of the image. |
Fields
R | The red channel data. |
G | The green channel data. |
B | The blue channel data. |
depth | The depth in bitlayers. |
Note that R, G and B must have values in the
range [0,255]. They must be matrices of the same dimension with the
number of rows equal to the height of the image, and the number of
columns equal to the width of the image. The elements in the first
row and the first column of the matrices represents the top left pixel.
Methods:
as.GrayImage | - | |
as.MonochromeImage | Converts an RGB image to a gray scale image. | |
as | - | |
as.RGBImage | - | |
crop | Crops the image. | |
dim | - | |
equals | Compares two RGBImage's. | |
getColors | - | |
paste | Pastes another RGBImage or image layers to this image. | |
readPPM | - | |
readRGB | - | |
writePBM | - | |
writePGM | - | |
writePPM | Writes the image to a file in Portable PixMap (PPM) format. | |
writeRGB | Writes the image to a file in RGB format. |
Methods inherited from BitmapImage:
as.character, depth, dim, getColorMap, getColors, height, image, plot, points, read, readJPEG, readUsingExternal, width, write, writeBMP, writeEPS, writeJPG, writePBM, writePGM, writePNG, writePPM, writeRGB
Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clone, detach, equals, extend, finalize, gc, getEnvironment, getFields, getInstanciationTime, getStaticInstance, hasField, hashCode, ll, load, objectSize, print, save
Henrik Bengtsson (http://www.braju.com/R/)
For converting images in of file formats see ImageMagick (http://www.imagemagick.org), which is free and available for many differt platforms.
rgb <- BitmapImage$read("logosm.ppm", path=system.file("images", package="R.image"))
layout(matrix(1:4,ncol=2))
image(rgb)
for (ch in 1:3) {
coefs <- c(0,0,0)
coefs[ch] <- 1
chimg <- as.RGBImage(rgb, coefs=coefs)
image(chimg)
}