title: trilinear interpolation on images with unequal dimensions in python
body: <p>I am trying to do a trilinear interpolation for an image. I tried using two functions from scipy <strong>interpn</strong> and <strong>RegularGridInterpolator</strong>. I had this link as a reference as it explains every step <a href="https://blog.finxter.com/scipy-interpolate-1d-2d-and-3d/" rel="nofollow noreferrer">https://blog.finxter.com/scipy-interpolate-1d-2d-and-3d/</a>  but this does only work if the arrays are of equal size. The width, height and depth (rgb channel) are of different size. Besides I also saw some simple examples on stack overflow but they don't seem to be helpful as for example <code>x = np.arange(10) </code> but for my case it seems to be more complicated than that and throwing this error even when I already tried to sort the elements (see the code below)</p>
  <blockquote>
  <p>python error: the points in dimension d must be strictly ascending or descending</p>
  </blockquote>
  <p>I would be very happy if somebody can offer help!</p>
  <p>Here is my code (still with the error mentioned above):</p>
  <p>`
  x1 = blurred_img[0]</p>
  <pre><code>x = np.sort(x1, axis=0)
  y1 = blurred_img[1]
  y = np.sort(y1, axis=0)
  z1 = blurred_img[2]
  z = np.sort(z1, axis=0)
  x_mesh, y_mesh, z_mesh = np.meshgrid(x, y, z)
  points = (x, y, z)
  values = func_3d(x_mesh, y_mesh, z_mesh)
  point = np.array([2.5, 3.5, 1.5])
  inn = interpolate.interpn(points, values, point)`
  </code></pre>