Adapted from code by Serge Belongie. Takes a “Difference of Gaussian” all centered on the same point but with different values for sigma. Also serves as an approximation to an Laplacian of Gaussian (LoG) filter (if order==1).
G = filterDog2d( r, var, order, [show] )
r – Final filter will be 2*r+1 on each side
var – variance of central Gaussian
order – should be either 1-LoG or 2-difference of 3 Gaussians
show –  figure to use for optional display
G – filter