def get_phases(self): sizeimg = np.real(self.imgfft).shape mag = np.zeros(sizeimg) for x in range(sizeimg[0]): for y in range(sizeimg[1]): mag[x][y] = np.arctan2(np.real(self.imgfft[x][y]), np.imag(self.imgfft[x][y])) rpic = MyImage(mag) rpic.limit(1) return rpic
def get_magnitude(self): sizeimg = np.real(self.imgfft).shape mag = np.zeros(sizeimg) for x in range(sizeimg[0]): for y in range(sizeimg[1]): mag[x][y] = np.sqrt( np.real(self.imgfft[x][y])**2 + np.imag(self.imgfft[x][y])**2) rpic = MyImage(mag) rpic.limit(1) return rpic
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
def get_imag_part(self): r = MyImage(np.imag(self.imgfft)) r.limit(1) return r
def get_real_part(self): r = MyImage(np.real(self.imgfft)) r.limit(1) return r