# rectangular window
   data(nztrees)
   plot(nztrees$window)
   abline(v=148, lty=2)
  # polygonal window
  plot(c(0,1),c(0,1),type="n")
  bdry <- locator()
  # click the vertices of a polygon (anticlockwise)
  w <- owin(c(0,1), c(0,1), poly=bdry)
  plot(w)
  # binary mask
  we <- erode.owin(w, 0.05, FALSE)
  plot(we)
  spatstat.options(par.binary=list(col=grey(c(0.5,1))))
  plot(we)Run the code above in your browser using DataLab