How to reduce for loops?
古いコメントを表示
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 件のコメント
cbentter
2016 年 5 月 21 日
This work could help you: FAST ALGORITHMS OF FOURIER AND HARTLEY TRANSFORM AND THEIR IMPLEMENTATION IN MATLAB by VíTÌZSLAV VESELÝ
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Transforms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!