How to save the FFt results of an image in an array?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nour Sd
el 16 de Nov. de 2018
Comentada: madhan ravi
el 16 de Nov. de 2018
Hello,
Please can you help me saving the result of the Fast Fourier Transform of an image so I can reuse it to draw the bessel function?
My code below, gives this error :
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in essai (line 13)
stored_values(ii) = Y;
clc;
close all;
imagefiles = dir('*.jpg');
nfiles = length(imagefiles); % Number of image files found
stored_values = zeros(nfiles,4); % Preallocate the array for saving the values
for ii=1:nfiles
currentfilename = imagefiles(ii).name;
I = imread(currentfilename);
myimage = rgb2gray(I); % Convert image to gray
Y = fft2(double(myimage))
stored_values(ii) = Y;
imagesc(abs(fftshift(Y)));
end
And if I change this line
stored_values(ii) = Y;
to this
stored_values(ii,1) = Y;
it gives this error:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in essai (line 13)
stored_values(ii,1) = Y;
Please can anyone correct it for me?
Thank you.
0 comentarios
Respuesta aceptada
madhan ravi
el 16 de Nov. de 2018
Editada: madhan ravi
el 16 de Nov. de 2018
stored_values = cell(1,nfiles); %before loop
stored_values{ii}=Y; %inside loop
celldisp(stored_values) %outside loop
[stored_values{:}] %double values
6 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Bessel functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!