Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
230 views
in Technique[技术] by (71.8m points)

python - Given points on a 3d function, f(x,y,z), and sampling points x,y find z where the function exists

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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...