# Matrix form of 2D-DFT for a vectorized image

I want to apply 2d DFT to a N by N image. However, image is vectorized such that it is NxN by 1. How can i find the matrix form of 2d DFT such that resulting vector from multiplication is the vectorized NxN by 1 2d DFT of my N by N image?

In matrix form, we can write the 2-D DFT of an Image $$\mathbf X$$ via $$\hat{\mathbf{X}} = \mathbf F \mathbf X \mathbf F^{\rm T}$$.

This expression can be vectorized with the help of the Kronecker product. Using [*], we obtain $$\hat{{\mathbf{x}}} = {\rm vec}\{\hat{\mathbf{X}}\} = (\mathbf F \otimes \mathbf F) \cdot \mathbf{x}.$$

This shows that the matrix you need is $$\mathbf F \otimes \mathbf F$$.

• thank you very much. Works like a charm! I cannot upvote due to my reputation though :/ Have a nice day! Jul 9, 2019 at 9:47
• You're welcome! Glad to hear it helped. You should be able to accept it as an answer though. ;-) Jul 9, 2019 at 10:56
• how about the inverse 2D-DFT?
– mlbj
Apr 6, 2023 at 14:40
• @mlbj: it would be quite similar, you would only need to replace $\mathbf F$ by its complex conjugate (and adjust for the scaling, depending on your preferred scaling convention), since $\mathbf F \mathbf F^{\rm H}$ is a scaled identity if $^{\rm H}$ denotes the conjugate (Hermitian) transpose. Apr 11, 2023 at 9:35
• thank you very much!
– mlbj
Apr 11, 2023 at 11:32