Complex pixel data of an Image

I’m looking to get the complex pixel values from an Image. Am I correct in saying that if I perform a Fourier transform on an image that the pixel data of the returned image is the complex pixel data of the original image. If i’m wrong, how to i get the complex pixel data of an image.

Good day Brian,

an image doesn’t have complex values, a 2D signal may have complex values.

So the first question is: Where do your images originate from?

If they come from cameras or other electro-optical devices, they are real-valued.

If however, you do a Fourier-transform of an image, the result will generally be a complex-valued 2D signal. In ImageJ-1 such signals are represented as stacks consisting of two slices. The first containing the real part, the second containing the imaginary part.



Hi Herbie, yes the image is a snapshot from a camera. I’m trying to write a java method which takes the Image’s pixel data, then makes two arrays, one for the real and one for the complex values.

So using ImageJ-1 I take the FFT of the image, them get each slice of the stack and copy the pixel data from each slice into its array?.

Thanks for the reply.

Dear Brian,

it would be of great help to know what you really want to do and why you are interested in complex values of an image that, as explained before, do not exist.

The Fourier-transform of an image is completely different from the underlying image. So please tell us what is so important with complex numbers and images.

BTW, each of the two slices of the complex-valued Fourier-transform (of an image) is in fact an array and of course an image itself is an array too. So why do you want/need to copy pixel data?
You may save an image as text image which actually is an array of numbers in text form.



Hi, sorry if I wasn’t clear, its part of a college project i’m doing. One part of my project is to take an image, get the real and imaginary parts of the images pixel data into two seperate arrays, take the arrays and perform the Amp and phase equations on the arrays, sqrt( real^2 + img^2) for Amp, and tan^-1(real/img) for the phase , then reconstruct the new Amp and Phase arrays into images.

Sorry too, Brian!

The main problem with your project is that an image is real-valued and has neither real and imaginary part nor modulus and phase!

If you mean the Fourier-transform of an image, then you are dealing with something rather different from the underlying image.

But even if you mean the Fourier-transform of an image and you represent its real and imaginary part as modulus and phase, then you must write a Fourier-re-transformation that accepts Fourier-spectral modulus and phase as input in order to regain the original image.

Still not sure where you want to go.



Hi Herbie, thanks for replying. I’m having trouble getting my idea and explanation across because I’m not fully sure on what I’m trying to do myself. But thanks for helping.

Sorry Kristy,

but what you write isn’t correct at all:

What is an “incoming signal in an image”?
A signal being a wave doesn’t mean it is complex-valued.

This is definitely wrong.
Why then are images, taken by cameras or the like, real-valued?

Please study the classical literature dealing with signals and their Fourier-transforms.

The text you are citing more or less deals with the idea or concept of spectral integral transformations. As it says, it deals with a “representation” of a signal not with the signal. Spectral transforms are signal representations, not the signal per se.

In short: Waves (and not only waves) can be represented by complex numbers but this implies a spectral transformation, e.g. in the way Fourier proposed it.

This however doesn’t imply that a spatial pictorial signal is complex-valued.

You are mixing two representations, the spatial and the spectral which are different domains that can be transformed into each other and per complex-valued Fourier transformation without any loss of information.

The fact that the Fourier-transform of a pictorial signal generally is complex-valued doesn’t mean that a pictorial signal is complex-valued.

What was initially called as being not correct is cited in the above answer.

A pictorial (spatial) signal need not be complex-valued in order to be Fourier-transformed. The OP told us that he needs to show complex-valued image data (thread title: “Complex pixel data of an image”) and I agree with @anon that pictorial signals (images) are not complex-valued although their Fourier transforms generally are.

1 Like

I don’t understand what this could mean.

What does that mean?

I have nothing to add.

Sorry but I have nothing to add.
Everything I could say concerning the issue raised by the OP has been said either by @anon or me.
(I’ve taught Fourier-theory for 45 years at various universities and there is still a lot to say about it, but the issue discussed here appears being rather unrelated.)

You need to ask yourself why we use Fourier transforms. We want to transfer the signal from the space domain to the frequency domain. In this domain, the signal has two “properties” - magnitude and phase. While the first (magnitude’s) importance is immediate, the phase is usually more important. We need it in image processing of 2D greyscale images to do Fourier.

Fully agreed with this.

I respect that this is your understanding, although is not perfectly mine when it comes to mathematics.

Please note that this is jargon.
Jean Baptiste Joseph Baron de Fourier (1768-1830) was a French mathematician and politician.

1 Like

Yes, I love Fourier. I edited my explanation above. Also I would like to take this opportunity to plug my website, which is a work in progress, but offers some tools in Python to elucidate Fourier.

1 Like

Just a quick followup that I updated the binder to reflect how signals from pixels are always real and positive. While phase can arbitrarily be made to appear as a complex sinusoid, it’s not necessary here. I’m trying to go back to delete previous comments so they don’t confuse anyone and a full explanation is here: Binder