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)
评论列表
文章目录