How to reduce for loops?
Mostrar comentarios más antiguos
Hello, I am currently working on 2-Dimensional Hartley transform.The code is shown below:
clc;clear all;close all;
img =imread('101_7.tif');
figure;imshow(img);
X = zeros(size(img,1),size(img,2));
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 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.
Thank you.
1 comentario
cbentter
el 21 de Mayo de 2016
This work could help you: FAST ALGORITHMS OF FOURIER AND HARTLEY TRANSFORM AND THEIR IMPLEMENTATION IN MATLAB by VíTÌZSLAV VESELÝ
Respuestas (0)
Categorías
Más información sobre Image Transforms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!