Filter löschen
Filter löschen

How can I use an image as a 2 dimentional function?

2 Ansichten (letzte 30 Tage)
Nour Sd
Nour Sd am 8 Nov. 2018
Bearbeitet: Nour Sd am 8 Nov. 2018
Hello, I am trying to do Fast Fourier Transform function on an image which should be put on a 2 dimentional function, here's the fft function downloaded from MathWorks ,
function Y=ft2
size=length(input);
l=log2(size);
p=ceil(l);
Y=input;
N = 2^p;
N2=N/2;
YY = -pi*sqrt(-1)/N2;
WW = exp(YY);
JJ = 0 : N2-1;
W=WW.^JJ;
for L = 1 : p-1
u=Y(:,1:N2);
v=Y(:,N2+1:N);
t=u+v;
S=W.*(u-v);
Y=[t ; S];
U=W(:,1:2:N2);
W=[U ;U];
N=N2;
N2=N2/2;
end;
u=Y(:,1);
v=Y(:,2);
Y=[u+v;u-v];
Y
I want to apply this function on a grayscale image with the command
schimage = ft2(myimage,2);
But it doesn't work and the error is "Error using ft2 Too many input arguments."
Can anyone help me please?
  3 Kommentare
Nour Sd
Nour Sd am 8 Nov. 2018
I don't know how, can you please give me instructions?
Stephen23
Stephen23 am 8 Nov. 2018
Your define the function ft2 to have zero input arguments:
function Y=ft2
and then try to call it with two input arguments. You should define the function with the correct number of input arguments that you require.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 8 Nov. 2018
  3 Kommentare
KSSV
KSSV am 8 Nov. 2018
X = imread('peppers.png') ;
X = rgb2gray(X) ;
Y = fft2(X);
imagesc(abs(fftshift(Y)))
Nour Sd
Nour Sd am 8 Nov. 2018
Bearbeitet: Nour Sd am 8 Nov. 2018
Okay, I don't know if it gives a good result in my case but thank you anyway.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Help Center und File Exchange

Produkte


Version

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by