def get_polar_t(self):
mag = self.get_magnitude()
sizeimg = np.real(self.imgfft).shape
pol = np.zeros(sizeimg)
for x in range(sizeimg[0]):
for y in range(sizeimg[1]):
my = y - sizeimg[1] / 2
mx = x - sizeimg[0] / 2
if mx != 0:
phi = np.arctan(my / float(mx))
else:
phi = 0
r = np.sqrt(mx**2 + my **2)
ix = map_range(phi, -np.pi, np.pi, sizeimg[0], 0)
iy = map_range(r, 0, sizeimg[0], 0, sizeimg[1])
if ix >= 0 and ix < sizeimg[0] and iy >= 0 and iy < sizeimg[1]:
pol[x][y] = mag.data[int(ix)][int(iy)]
pol = MyImage(pol)
pol.limit(1)
return pol
评论列表
文章目录