title: scikit-image Gabor filter error: `filter weights array has incorrect shape`
body: <p>Input is a greyscale image, converted to a 130x130 numpy matrix. I always get the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test_final.py", line 87, in &lt;module&gt;
      a._populate_gabor()
  
    File "C:\Users\Bears\Dropbox\School\Data Science\final.py", line 172, in _populate_gabor
      self.gabor_imgs[i] = self._matrix_2_1d(self._gabor_this(self.grey_imgs[i]),kernels[0])
  
    File "C:\Users\Bears\Dropbox\School\Data Science\final.py", line 179, in _gabor_this
      filtered = ndi.convolve(image, kernel, mode='reflect')
  
    File "C:\Users\Bears\Anaconda3\lib\site-packages\scipy\ndimage\filters.py", line 696, in convolve
      origin, True)
  
    File "C:\Users\Bears\Anaconda3\lib\site-packages\scipy\ndimage\filters.py", line 530, in _correlate_or_convolve
      raise RuntimeError('filter weights array has incorrect shape.')
  RuntimeError: filter weights array has incorrect shape.
  </code></pre>
  
  <p>my code is as follows</p>
  
  <pre><code>def _populate_gabor(self):
      kernels = []
      for theta in range(self.gabor_range[0],self.gabor_range[1]):
          theta = theta / 4. * np.pi
          for sigma in (1, 3):
              for frequency in (0.05, 0.25):
                  kernel = np.real(gabor_kernel(frequency, theta=theta,
                                        sigma_x=sigma, sigma_y=sigma))
                  kernels.append(kernel)
      print (len(kernels))
  
      for i in range(self.length):
          self.gabor_imgs[i] = self._matrix_2_1d(self._gabor_this(self.grey_imgs[i]),kernels[0])
  
  
  def _gabor_this(image, kernels): 
      feats = np.zeros((len(kernels), 2), dtype=np.double)
      for k, kernel in enumerate(kernels):
          filtered = ndi.convolve(image, kernel, mode='reflect')
          feats[k, 0] = filtered.mean()
          feats[k, 1] = filtered.var()
      return feats
  </code></pre>
  
  <p>I took this code directly from the example at <a href="http://scikit-image.org/docs/dev/auto_examples/plot_gabor.html" rel="nofollow">http://scikit-image.org/docs/dev/auto_examples/plot_gabor.html</a> and I can't figure out how to get around this error. Any help would be appreciated.
  Note that all the other functions are working with other filters, just not gabor.</p>