Learn R Programming

spc4sts (version 0.2.1)

diagnoseLD: Diagnose Local Defects on Stochastic Textured Surfaces

Description

Produces a binary diagnostic image of a given stochastic textured surface image based on its spatial moving statistics.

Usage

diagnoseLD(ls, dth, plot.it = TRUE)

Arguments

ls

the output from localStat()

dth

the diagnostic threshold

plot.it

plots the binary diagnositc image if set to TRUE

Value

The binary diagnostic image in matrix format.

References

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

See Also

localStat, climit

Examples

Run this code
# NOT RUN {
## build the in-control model
img <- sarGen(m = 100, n = 100, border = 50) # training image
model <- surfacemodel(img,1)

## diagnose a Phase II image
img2 <- sarGen(m = 100, n = 100, border = 50)
img2 <- imposeDefect(img2)
ls <- localStat(img2$img, model, stat = "ad", w = 5)
bimg <- diagnoseLD(ls, dth = 9, plot.it = FALSE) # use climit() to find dth
par(mfcol = c(1, 2))
par(mar = c(2, 0.5, 1, 0.5))
image(xaxt = 'n', yaxt = 'n', as.matrix(t(apply(img2$img , 2, rev))),
      col = gray((0:32)/32), xlab = '', ylab = '', asp = 1, bty = 'n')
image(xaxt = 'n', yaxt = 'n', as.matrix(t(apply(bimg , 2, rev))),
      col = gray(c(1, .5)), xlab = '', ylab = '', asp = 1, bty = 'n')
# }

Run the code above in your browser using DataLab