initializations.py 文件源码

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

项目:mcv-m5 作者: david-vazquez 项目源码 文件源码
def bilinear(w, h):
    import math
    data = np.zeros((w*h), dtype=float)
    f = math.ceil(w / 2.)
    c = (2 * f - 1 - f % 2) / (2. * f)
    # print ('f:{}, c:{}'.format(f, c))
    for i in range(w*h):
        x = float(i % w)
        y = float((i / w) % h)
        v = (1 - abs(x / f - c)) * (1 - abs(y / f - c))
        # print ('x:{}, y:{}, v:{}'.format(x, y, v))
        np.put(data, i, v)
    data = data.reshape((h, w))
    return data


# Create 4D bilinear interpolation kernel in numpy for even size filters
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号