# make up an image
X <- setcov(unit.square())
plot(X)
# a rectangular subset
W <- owin(c(0,0.5),c(0.2,0.8))
X[W] <- 2
plot(X)
# a polygonal subset
data(letterR)
R <- affine(letterR, diag(c(1,1)/2), c(-2,-0.7))
X[R] <- 3
plot(X)
# a point pattern
P <- rpoispp(20)
X[P] <- 10
plot(X)
# change pixel value at a specific location
X[list(x=0.1,y=0.2)] <- 7
Run the code above in your browser using DataLab