title: Interpolate image at specific coordinates
body: <p>Given an image (array) in rectangular form, how do I interpolate specific pixel positions? The following code produces as 20x30 grid, with each pixel filled with a value (<code>zg</code>). The code then constructs an interpolator with scipy's <code>interp2d</code> method. What I want is to obtain interpolated values at specific coordinates. In the given example, at <code>x = [1.5, 2.4, 5.8], y = [0.5, 7.2, 2.2]</code>, so for a total of 3 positions. However, the function returns a 3x3 array for some reason. Why? And how would I change the code so that only these three coordinates would be evaluated?</p>
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  from scipy.interpolate import interp2d
      
  # Rectangular grid
  x = np.arange(20)
  y = np.arange(30)
  xg, yg = np.meshgrid(x, y)
  zg = np.exp(-(2*xg)**2 - (yg/2)**2)
      
  # Define interpolator
  interp = interp2d(yg, xg, zg)
      
  # Interpolate pixel value
  zi = interp([1.5, 2.4, 5.8], [0.5, 7.2, 2.2])
      
  print(zi.shape) # = (3, 3)
  </code></pre>