v1like.py 文件源码

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

项目:nimo 作者: wolfram2012 项目源码 文件源码
def sresample(src, outshape):
    """ Simple 3d array resampling

    Inputs:
      src -- a ndimensional array (dim>2)
      outshape -- fixed output shape for the first 2 dimensions

    Outputs:
       hout -- resulting n-dimensional array

    """

    inh, inw = src.shape[:2]
    outh, outw = outshape
    hslice = (np.arange(outh) * (inh-1.)/(outh-1.)).round().astype(int)
    wslice = (np.arange(outw) * (inw-1.)/(outw-1.)).round().astype(int)
    hout = src[hslice, :][:, wslice]
    return hout.copy()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号