How to save the FFt results of an image in an array?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
madhan ravi
2018 年 11 月 16 日
編集済み: madhan ravi
2018 年 11 月 16 日
stored_values = cell(1,nfiles); %before loop
stored_values{ii}=Y; %inside loop
celldisp(stored_values) %outside loop
[stored_values{:}] %double values
6 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Bessel functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!