Learn R Programming

spc4sts (version 0.1.1)

dataPrep: Neighborhood Data Preparation

Description

Prepares a neighborhood data from a given image.

Usage

dataPrep(image, nb, vars = NULL)

Arguments

image

the given image in the matrix format.

nb

the size of the neighborhood. It must be either a scalar or a vector of length 3.

vars

names of all the variables that are to be included in the neighborhood data (e.g., vars=c("V2","V3")).

Value

A dataframe with column names "V1", "V2", "V3", ... The first column "V1" contains the response pixel, whereas the other columns contain pixels in the neighborhood (with size nb) of the response pixel.

References

Bui, A.T., and Apley., D.W. (2017) A Monitoring and Diagnostic Approach for Stochastic Textured Surfaces", Technometrics (in press).

See Also

surfacemodel

Examples

Run this code
# NOT RUN {
## construct the neighborhod data from a simulated image
img <- sarGen(m = 100, n = 100, border = 50)
dat <- dataPrep(img,1)

## to rotate an image by 90 degrees clockwise, use:
img2 <- as.matrix(t(apply(img , 2, rev)))
# }

Run the code above in your browser using DataLab