R/mexican_hat_brush.R

Defines functions mexican.hat.brush

Documented in mexican.hat.brush

#' Mexican hat brush
#' to use with filter2
#' @param n size of brush
#' @param sigma2 standard deviation
#'
#' @return brush
#' @export 

mexican.hat.brush<-function(n=7,sigma2=1)
{
  matrix<-array(0,c(n,n))
  m<-(n+1)/2
  for (x in (1:n)-m)
    for (y in (1:n)-m)
    {
      matrix[x+m,y+m]<- -exp(-(x*x+y*y)/2/sigma2)*(1-(x*x+y*y/2/sigma2))/sigma2/sigma2/pi
    }
  matrix<-matrix/sum(matrix)
}

Try the bioimagetools package in your browser

Any scripts or data that you put into this service are public.

bioimagetools documentation built on May 28, 2022, 5:06 p.m.