# Phase of an image in the frequency domain

The following picture is amplitude and phase of an image filtered using Gabor filter in the frequency domain. I'm trying to reproduce the results, I'm getting valid results for the amplitude I think, but I'm struggling with the the phase, I'm just getting a noisy image that does not resemble the picture. I'm referencing this paper 2

My code looks roughly like this (Python + OpenCV):

# DFT of the source image
dft = cv2.dft(...)
# DFT of the Gabor filter
kernel_dft = cv2.dft(...)
filtered = dft * kernel_dft # using cv2.mulSpectrums()
image = cv2.idft(filtered)


image is then complex array so i use cv2.cartToPolar() to extract magnitude and phase.

But I'm struggling what the following paragraph exactly means (from the paper):

The resulting spatial frequency band is localized in space, scale and orientation (see [Portilla and Simoncelli 2000] for filter design steps). The transfer functions of a complex steerable pyramid only contain the positive frequencies of the corresponding real steerable pyramid’s filter. That is, the response of 2 cos(!x) = e^(iwx) + e^(iwx) is e^(iwx) so that there is a notion of both amplitude and phase.

I'm not sure how to proceed, as I'm not an expert in this matter, so if anybody could offer some clarification I'd be very happy.

• did you find a way to make render the image with the phase ? – qtx Jul 5 '16 at 8:17
• Why are you using cartToPolar()? A complex image has a real and imaginary part and does not need any coordinate transformation per se. To get the magniture, use $\sqrt{R^2 + I^2}$ and for the phase $\arctan{I/R}$ - or other appropriate functions, if available. Could you also provide your images so that we might spot some information on your approach in them? – M529 Jul 5 '16 at 8:59