title: Efficient convolution of two images along one axis
body: <p>I have two large grayscale images. Either PIL.Image or numpy data structure. </p>
  
  <p>How do I do 1d convolution of the two images along one axis? </p>
  
  <p>The best I come up with is</p>
  
  <pre><code>def conv2(im1, im2, *args):
      res = 0
      for l1, l2 in zip(im1, im2):
          res += np.convolve(l1, l2, *args)
      return res
  </code></pre>
  
  <p>Which works, but not extremely fast. Is there a faster way?</p>
  
  <p>Please note that all the 2D convolution functions are probably not relevant since I am not interested in a 2D convolution. I've seen this question on SO before, but I didn't see a better answer than my code. So I'm bumping it again.</p>