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

Categories

0 votes
243 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...