imageMatrix-class: Class "imageMatrix"

Description Objects from the Class Slots Extends Methods Author(s) Examples

Description

Makes an imageMatrix object from a matrix.

Objects from the Class

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.

Slots

.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

Extends

Class "structure", directly. Class "vector", by class "structure", distance 2, with explicit coerce.

Methods

plot

signature(x = "imageMatrix"): ...

show

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.

Author(s)

Solomon Messing <[last-name] at stanford dot edu>

Examples

1
2
3
	
	clinton = new("imageMatrix", X = readPNG(system.file("extdata", "Clinton.png", package="ImageMetrics")), type = "rgba")
	plot(clinton)

SolomonMg/ImageMetrics documentation built on May 27, 2019, 7:39 a.m.