polarTransform.py 文件源码

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

项目:imgProcessor 作者: radjkarl 项目源码 文件源码
def polarToLinearMaps(orig_shape, out_shape=None, center=None):
    s0, s1 = orig_shape
    if out_shape is None:
        out_shape = (int(round(2 * s0 / 2**0.5)) - (1 - s0 % 2),
                     int(round(2 * s1 / (2 * np.pi) / 2**0.5)))
    ss0, ss1 = out_shape

    if center is None:
        center = ss1 // 2, ss0 // 2

    yy, xx = np.mgrid[0:ss0:1., 0:ss1:1.]
    r, phi = _cart2polar(xx, yy, center)
    # scale-pi...pi->0...s1:
    phi = (phi + np.pi) / (2 * np.pi) * (s1 - 2)

    return phi.astype(np.float32), r.astype(np.float32)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号