sphere_transforms_numpy.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:spherical_image_editing 作者: henryseg 项目源码 文件源码
def get_interpolated_pixel_color_rbspline(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)

    pts_vec = pts.reshape((2,-1))
    out_vec = out.reshape((-1,s_im.shape[-1])) #flatten for easier vectorization
    for i in range(s_im.shape[-1]): #loop over color channels
        rbspline = RectBivariateSpline(ycoords, xcoords, s_im[...,i])
        out_vec[:,i] = rbspline.ev(pts_vec[0],pts_vec[1])
    return out


### Functions generating SL(2,C) matrices ###
# Do not need to be vectorized #
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号