Fourier transform along only one dimension of 2D array

I'm a relative newbie to Mathematica

Before you flag me as duplicate, note that I have read and studied "Fourier transform over a custom dimension" as best I can. I cannot understand the answer, it uses a lot of advanced notation. I can't even tell if this is the same question or not.

I have a 2D array generated from an image:

tdomain = ImageData[Import["filename.png"]]

I want to fourier transform this array along only one of the dimensions, the rows. The 2D Fourier also runs transform over the columns, not what I want. Can you please help me to Fourier transform only the rows?

I have tried every which way with the function Fourier. It seems to me that it should support my goal, but I can't get it to do anything useful.

Following the answer in "Fourier transform over a custom dimension", I experimented with the Map function, but the documentation is so terse I can't figure it out.

Finally, I wrote a for loop, which seems to work. Here is a working example:

In:= tdomain = ImageData[Import["filename.jpg"]]
In:= Dimensions[tdomain]
Out= {218, 1012}
In:= fdomain = Array[0 &, {218, 1012}]

In:= For[i = 1, i < 219, i++,
trow = tdomain[[i]];
frow = Fourier[trow];
fdomain[[i]] = frow;
]

(* Then, for fun *)
Image[Re[fdomain]]

There has got to be a better way, right?

• I think what you are doing can be reduced to Image[Re[Fourier /@ tdomain]] – m_goldberg Oct 11 '17 at 21:47
• For the benefit of readers, you could link to the previous question: Fourier transform over a custom dimension – Rahul Nov 14 '17 at 16:57