def get_interpolated_pixel_color(pts, s_im, size):
"""given pts in floats, linear interpolate pixel values nearby to get a good colour"""
pts = clamp(pts, size)
s_im = np.atleast_3d(s_im)
ys,xs = size
ycoords, xcoords = np.arange(ys), np.arange(xs)
out = np.empty(pts.shape[1:] + (s_im.shape[-1],),dtype=s_im.dtype)
for i in range(s_im.shape[-1]): #loop over color channels
map_coordinates(s_im[...,i],pts,out[...,i],mode='nearest')
return out
sphere_transforms_numpy.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录