Learn R Programming

spc4sts (version 0.6.3)

sarGen: Stochastic Autoregressive Image Generator

Description

Generates a 2D stochastic AR(1) image.

Usage

sarGen(phi1 = .6, phi2 = .35, sigma = .01, m = 250, n = 250, border = 200)

Arguments

phi1

the parameter phi1 of the process.

phi2

the parameter phi2 of the process.

sigma

the parameter sigma of the process.

m

the number of rows of the generated image.

n

the number of columns of the generated image.

border

the number of top rows/left columns to be cut off from the generated image. This helps reduce the effect of the starting condition.

Value

The generated image in the matrix format.

Details

The pixel y(i,j) of the 2D AR(1) process satisfies: y(i,j) = phi1*y(i-1,j) + phi2*y(i,j-1) + e(i,j), where e(i,j) follows a zero-mean Gaussian distribution with standard deviation of sigma. The process is then rescaled to [0, 255] to produce a greyscale image.

References

Bui, A.T. and Apley., D.W. (2018a) "A Monitoring and Diagnostic Approach for Stochastic Textured Surfaces", Technometrics, 60, 1-13.

See Also

imposeDefect

Examples

Run this code
# NOT RUN {
## generate an image without defects
img <- sarGen(m = 100, n = 100, border = 50)
image(img,col=gray(c(0:32)/32))
# }

Run the code above in your browser using DataLab