Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def forward_transform(self, matrix):
- """Computes the forward Fourier transform of the input matrix
- takes as input:
- matrix: a 2d matrix
- returns a complex matrix representing fourier transform"""
- print(np.exp( -1*( pow(-1,0.5)*(2*np.pi)/2)*(0*1+0*1) ) )
- width,height=matrix.shape
- newMatrix= np.zeros((height,width), dtype=complex)
- for i in range(width):
- for j in range(height):
- for u in range (width):
- for v in range(height):
- multiple= (i*u+j*v)
- piPart=(2*np.pi)/width
- ePart=np.exp(-1j*piPart*multiple)
- newMatrix[i,j]=newMatrix[i,j]+(matrix[u,v]*ePart)
- #print(newMatrix)
- #matrix=np.fft.fft2(matrix)
- return newMatrix
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement