erf is the error function, the integral of a gaussian curve. My understanding of the criterion is that the gaussian must be in the window size. At 2 sigma, you get something like 99% of the area below a gaussian curve. So, 3 or 4 (instead of 6.4) would do the job as well if i'm right. 

https://en.wikipedia.org/wiki/Error_function