Learn R Programming

spc4sts (version 0.1.1)

imposeDefect: Superimpose Local Defects

Description

Superimposes a local defect (a 2D stochastic AR(1) image from sarGen) on a given image.

Usage

imposeDefect(img, loc = NULL, a = 7, b = 10, eps = 0.05, phi1 = 0, phi2 = 0, sigma = 0.01)

Arguments

img

the image to be superimposed a defect.

loc

the location of the defect in the generated image.

a

2*a + 1 is the vertical axis length of the ellipsoidal defect.

b

2*b + 1 is the vertical axis length of the ellipsoidal defect.

eps

controls the curvature of the ellipsoidal defect.

phi1

the parameter phi1 of the defect.

phi2

the parameter phi2 of the defect.

sigma

the parameter sigma of the defect.

Value

If defect = TRUE, a list of the following:

img

the generated image in the matrix format.

defect.info

the information of the defects.

Details

The pixel y(i,j) of the defect 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.

References

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

See Also

sarGen

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))

## superimpose a defect
img <- imposeDefect(img)
image(img$img,col=gray(c(0:32)/32))
# }

Run the code above in your browser using DataLab