cannot show full image in folder
Mostra commenti meno recenti
Hi everyone !
Ask permission. why can't it show all the pictures in one folder. The results displayed in excel are only 1 image.
this is my code :

image_folder ='E:\coba11gambar';
filenames = dir (fullfile(image_folder,'*.jpeg'));
total_images = numel(filenames);
for n= 1:total_images;
f= fullfile(image_folder, filenames(n).name)
our_images= imread (f);
% CONTRAST STRECHING
s = imadjust (our_images,stretchlim(our_images,[0.01 0.99]),[]); %menentukan nilai maksimum dan minimum untuk peregangan
% SEGMENTASI DETEKSI TEPI CANNY
g=edge(s,'canny')
% GLCM
offsets = [0 1; -1 1; -1 0; -1 -1];
glcm=graycomatrix(g,'Offset',[0 1]);%sudut 0
% mmengambil properti yang ada dalam matriks kookurensi
stats=graycoprops(glcm,{'Contrast','Energy','Correlation','Homogeneity'});
% membaca fitur glcm
rata=mean(mean(glcm));
standar=std(std(double(glcm)));
energi=stats.Energy;
entropi=entropy(glcm);
kontras=stats.Contrast;
korelasi=stats.Correlation;
homog=stats.Homogeneity;
vari=var(var(double(glcm)));
training= [energi;entropi;kontras;korelasi;homog;vari;rata;standar]';
cd('..');
xlswrite('Cobaaaa1.xls',training) %menyimpan file dalam bentuk excel
end;
%%
disp 'done'
1 Commento
Stephen23
il 30 Mag 2022
Get rid of CD.
Risposta accettata
Più risposte (2)
Walter Roberson
il 30 Mag 2022
xlswrite('Cobaaaa1.xls',training) %menyimpan file dalam bentuk excel
That is asking to write to the same file and same sheet and same range each time.
Unfortunately in your release you cannot use the more modern writematrix(), and the writetable() in your release did not support 'WriteMode' 'append'
I suggest you specify a range, such as
sheet = 1;
range = sprintf('A%d', i);
xlswrite('Cobaaaa1.xls', sheet, range, training);
Note: you need to specify the sheet in order to be able to use a range that just specifies a starting corner without an ending corner.
1 Commento
Walter Roberson
il 30 Mag 2022
sheet = 1;
range = sprintf('A%d', n);
xlswrite('Cobaaaa1.xls', sheet, range, training);
Armylia Dewi
il 30 Mag 2022
0 voti
Categorie
Scopri di più su Multirate Signal Processing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
