Example #1
0
 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
Example #2
0
 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
Example #3
0
    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
Example #4
0
 def get_imag_part(self):
     r = MyImage(np.imag(self.imgfft))
     r.limit(1)
     return r
Example #5
0
 def get_real_part(self):
     r = MyImage(np.real(self.imgfft))
     r.limit(1)
     return r