title: OpenCV: Efficient Difference-of-Gaussian
body: <p>I am trying to implement <a href="http://en.wikipedia.org/wiki/Difference_of_Gaussians" rel="noreferrer">difference of guassians</a> (DoG), for a specific case of edge detection. As the name of the algorithm suggests, it is actually fairly straightforward:</p>
  
  <pre><code>Mat g1, g2, result;
  Mat img = imread("test.png", CV_LOAD_IMAGE_COLOR); 
  GaussianBlur(img, g1, Size(1,1), 0);
  GaussianBlur(img, g2, Size(3,3), 0);
  result = g1 - g2;
  </code></pre>
  
  <p>However, I have the feeling that this can be done more efficiently. Can it perhaps be done in less passes over the data? </p>
  
  <p>The question <a href="https://stackoverflow.com/questions/8308325/opencv-make-a-difference-of-gaussian/14141790">here</a> has taught me about separable filters, but I'm too much of an image processing newbie to understand how to apply them in this case.</p>
  
  <p>Can anyone give me some pointers on how one could optimise this?</p>