setcov(W, V=W, ...)"owin".as.mask
    to control the pixel resolution."im") representing the
  set covariance function of W,
  or the cross-covariance of W and V.  We may interpret $C(v)$ as the area of the set of
  all points $x$ in $W$ such that $x+v$ also lies in
  $W$.
  
  This command computes a discretised approximation to
  the set covariance function of any
  plane region $W$ represented as a window object (of class
  "owin", see owin.object). The return value is
  a pixel image (object of class "im") whose greyscale values
  are values of the set covariance function.
  The set covariance is computed using the Fast Fourier Transform,
  unless W is a rectangle, when an exact formula is used.
  If the argument V is present, then setcov(W,V)
  computes the set cross-covariance function $C(x)$
  defined for each vector $x$
  as the area of the intersection between $W$ and $V+x$.
imcov,
  owin,
  as.owin,
  erosionw <- owin(c(0,1),c(0,1))
  v <- setcov(w)
  plot(v)Run the code above in your browser using DataLab