This function will generate images of a specified type
simTexture(n = 256, sd = 1, K = 150, imtype = "S1", ...)
A list of length K
, with each list entry being an image of dimension n x n
with the chosen spectral structure.
The dimension of the image to be generated.
The standard deviation of the increments of the LS2W process to be generated.
The number of images to generate.
The type of image(s) to create. Must be one of "S1","S2","S3","S4", "NS1","NS2", "NS3", "NS4","NS5","NS6", "NS7". See details for descriptions of the processes.
Any other optional arguments needed for the image generation (see details).
Sarah L. Taylor and Matt Nunes
Generating lots of images of high dimension may take a long time!
Note that as of version 2.1-4 (2022-05-09), textures S3 and NS2 have been temporarily removed (commented out) from the functionality of this function, due to a broken package (RandomFields).
Several different processes can be generated with the simTexture
function. The stationary processes are: a random normal process of specified standard deviation, sd
(S1
); a spatial moving average process with parameter rho
(S2
); an isotropic random field with a Matern covariance with shape parameter nu
(S3
) and a diagonal Haar moving average process of a specified order order
and standard deviation sd
(S4
) (see the Haar2MA.diag
function in the LS2W
package for more details).
The nonstationary processes are: a random field with unit standard deviation on the first half-plane, concatenated with a random normal half-plane of standard deviation sd
(NS1
); a white noise half-plane concatenated with a Matern stationary process (NS2
); a Haar Montage of specified standard deviation sd
(NS3
) (see the LS2W
HaarMontage
function for more details); a process with a slowly-varying covariance structure (NS4
); a white noise process with a central subregion of random Normal deviates with non-unit standard deviation sd
(NS5
); a white noise process with a subregion of random Normal deviates with non-unit standard deviation in the middle section of the top left quadrant sd
(NS6
); the final process is similar to NS5
, except that there is an additional texture in a subregion of the image. In other words, the image is a montage of three two-dimensional Normal processes with differing standard deviations. The base texture is again of unit variance, whereas the other two textures have standard deviations sd
and
sd2
(NS7
).
The other optional arguments for simTexture
are as follows:
type
- the type of neighbourhood dependence for the random field, either "queen"
or "rook"
(see the cell2nb
function documentation in the spdep
package for more details).
rho
- moving average parameter for the process S2
.
nu
- shape parameter for the Matern covariance for process S3
.
order
- Haar moving average order for S4
.
fn
- scurve
or lincurve
for NS4
.
start
- start value for NS4
(passed into scurve
or lincurve
).
end
- end value for NS4
(passed into scurve
or lincurve
).
a
- "gradient" for NS4
(passed into scurve
or lincurve
).
prop
- proportion of inserted subimage for NS5
, NS6
and the first subimage (NS7
).
sd2
- standard deviation of second inserted subimage for NS7
.
prop2
- proportion of second inserted subimage for NS7
.
pos1
- position of first inserted subimage for NS7
.
pos2
- position of second inserted subimage for NS7
.
Matern, B. (1960) Spatial variation. Stochastic models and their application to some problems in forest surveys and other sampling investigations Meddleanden fran statens Skogsforskningsinstitut 49 (5).
Eckley, I.A., Nason, G.P., and Treloar, R.L. (2010) Locally stationary wavelet fields with application to the modelling and analysis of image texture Journal of the Royal Statistical Society Series C, 59, 595-616.
Taylor, S.L., Eckley, I.A., and Nunes, M.A. (2014) A Test of Stationarity for Textured Images. Technometrics, 56 (3), 291-301.
HaarMontage
X1 <- simTexture(128,K=1,imtype="S4",order=3)
X2 <- simTexture(128,K=1,imtype="NS4",fn=lincurve,a=.25,start=1,end=2)
X3 <- simTexture(128,K=1,imtype="NS5",sd=1.6,prop=.25)
X4 <- simTexture(128,K=1,imtype="NS7",sd=1.6,prop=.25,sd2=2.8, prop2=0.25,
pos1=c(10,10),pos2="e")
# try plotting the images:
if (FALSE) image(plotmtx(X1[[1]]))
Run the code above in your browser using DataLab