# Convolution in the Hartley Domain

The convolution Theorem of the Hartley Transform is given by

$$Y_{Ha}(k) = X_{Ha}(k)H_{Ha}^{e}(k) + X_{Ha}(-k)H_{Ha}^{o}(k)$$

where,

$$H_{Ha}^{e}(k) = \frac{H_{Ha}(k) + H_{Ha}(-k)}{2}$$ $$H_{Ha}^{o}(k) = \frac{H_{Ha}(k) - H_{Ha}(-k)}{2}$$

I tried the following implementation in Python,

HIMG_ = np.flip(np.flip(HIMG, -1), -2)
HKERNEL_ = np.flip(np.flip(HKERNEL, -1), -2)

HKERNEL_e = 0.5 * (HKERNEL + HKERNEL_)
HKERNEL_o = 0.5 * (HKERNEL - HKERNEL_)

ya_hartley_1 = HT((HIMG * HKERNEL_e) + (HIMG_ * HKERNEL_o))
imshow(ya_hartley_1)


And this was the output, This is the output if convolution is done on spatial or Fourier domain, The complete code is available on a kernel on Kaggle

Here is my question,

What is wrong with it? Why the output is not the same as the spatial or FFT convolution?

• Why do you expect them to be the same? – MBaz Jan 29 at 23:50
• Because I think this is what the convolution theorem is about. The convolution in the frequency domain should be equivalente to the convolution on the spatial domain. – Eduardo Reis Jan 30 at 3:50
• But you do seem to be getting the same result on spatial and Fourier (your last image). It's when you use the Hartley transform that you get a different result, right? I know very little about image processing, but I know that the Hartley transform is not the same as Fourier (though they're closely related), so you'll get different results if you use it. – MBaz Jan 30 at 15:11
• Think on this way, convolution is a spatial operation. But it has its equivalency on the Fourier space, which is given by the convolutional theorem of the Fourier Transform. The Hartley Transform also has its own convolutional Theorem. By definition, the result of both convolution in the Fourier Domain, as the convolution in the Hartley domain, after applying their respective inverse transform, should be the same as the result of the convolution in the spatial domain. – Eduardo Reis Jan 30 at 21:24