title: 2d convolution using python and numpy
body: <p>I am trying to perform a 2d convolution in python using numpy</p>
  
  <p>I have a 2d array as follows with kernel H_r for the rows and H_c for the columns</p>
  
  <pre><code>data = np.zeros((nr, nc), dtype=np.float32)
  
  #fill array with some data here then convolve
  
  for r in range(nr):
      data[r,:] = np.convolve(data[r,:], H_r, 'same')
  
  for c in range(nc):
      data[:,c] = np.convolve(data[:,c], H_c, 'same')
  
  data = data.astype(np.uint8);
  </code></pre>
  
  <p>It does not produce the output that I was expecting, does this code look OK, I think the problem is with the casting from float32 to 8bit. Whats the best way to do this</p>
  
  <p>Thanks</p>