I have the function values at a set of 3d points i.e. I know f(x,y,z)
. Now I want to sample this function at a different set of points (x',y')
. But I don't know z
. I need to first find the values of z
where the function exists (not nan
) for every point (x',y')
and then find the value of the function at this point. My code is in python. I tried using scipy.interpolate.griddata()
but I need to give a grid of z
values as well. And hence I'm stuck. Is it possible to do this? If yes, how? Any other suggestions are also appreciated
import numpy
import scipy.interpolate
image = numpy.array([[246, 50, 101], [116, 1, 113], [187, 110, 64]])
depth = numpy.array([[5, 3, 5], [20, 25, 3], [45, 23, 11]])
height, width = image.shape
iy = numpy.array([[1.5, 0.2, 2.3], [1.6, 0.1, 2.8], [2.4, 2.6, 2.5]])
ix = numpy.array([[0.1, 2.1, 1.7], [1.2, 2.3, 0.7], [0.1, 1.9, 2.7]])
indices = numpy.stack([ix, iy, depth], axis=2)
y = numpy.array(range(height))
x = numpy.array(range(width))
# Find z such that f(x,y,z) exists.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…