title: Boundary conditions for image transformations with meshgrid
body: <p>I transformed an image using <code>meshgrid</code>, but the new coordinates are partially outside the range of the original image, causing the transformation to fail.</p>
  
  <p>First I used clip </p>
  
  <pre><code>...
  tX = numpy.clip(tX.astype(numpy.int),0,image.w)
  tY = numpy.clip(tY.astype(numpy.int),0,image.h)
  result image([tX,tY])
  </code></pre>
  
  <p>which resulted in effect similar to the 'nearest' boundary condition.</p>
  
  <p>I would like for all the outside pixels to be black. I thought I could achieve this by using a boolean array on the meshgrid, but I don't know how to apply the boolean array to the meshgrid correctly.</p>
  
  <pre><code>tXbool = numpy.abs(tX) &lt; image.w
  tXbool.shape
  (850, 1280)
  tX[tXbool].shape
  (193180,)
  </code></pre>