I am currently working on 2D Hartley transform. The code is shown below:
for u=1:size(img,1)
for v=1:size(img,2)
for x=1:size(img,1)
for y=1:size(img,2)
a = 2*pi*u*x/size(img,1);
b = 2*pi*v*y/size(img,2);
temp= img(x,y)*(cos(a+b) + sin(a+b));
X(u,v)= X(u,v)+temp;
end
end
end
end
It has 4 for
loops and it takes a very long time to execute this. Is there any method to make it more efficient by reducing the amount of for
loops? Anything regarding this would be very helpful.
The formula used for this 2-D Hartley transform is shown below:
Reference:Separable two-dimensional discrete Hartley transform by Andrew B. Watson and Allen Poirson.