Description Objects from the Class Slots Extends Methods Author(s) Examples
Makes an imageMatrix object from a matrix.
Objects can be created by calls of the form new("imageMatrix", X, type, ncol, nrow, ...)
.
X should be given as a 2 dimensional matrix for grey-scale, 3 dimensional array for a color image (row, column, rgb channel), X[,,1], X[,,2], X[,,3] are the red, green, and blue planes, respectively.
The code for this object was inspired by the imagematrix package. The major difference between imageMatrix and imagematrix is the S4 representation and additional functionality in terms of plotting.
.Data
:Object of class "vector"
~~
X
:Object of class "array"
corresponding to image pixels
type
:Object of class "character"
corresponding to "rgb", "rgba", or "grey"
imgdim
:Object of class "numeric"
~~
ncol
:Object of class "numeric"
, the width of the image
nrow
:Object of class "numeric"
, the height of the image
Class "structure"
, directly.
Class "vector"
, by class "structure", distance 2, with explicit coerce.
signature(x = "imageMatrix")
: ...
signature(object = "imageMatrix")
: ...
The plot(imageMatrix) method converts the values to rgb values that R understands and then uses rasterImage() to plot, which is a much faster way to view these kinds of objects than by using the image() function.
The show() method outputs the image size and type.
Solomon Messing <[last-name] at stanford dot edu>
1 2 3 |
clinton = new("imageMatrix", X = readPNG(system.file("extdata", "Clinton.png", package="ImageMetrics")), type = "rgba")
plot(clinton)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.