Effacer les filtres
Effacer les filtres

how can i make a csv file from multiple tif or jpg image ??

6 vues (au cours des 30 derniers jours)
Beyung Doo Jo
Beyung Doo Jo le 22 Sep 2011
for i= 1:12 file_name=['C:\Users\Lab\Desktop\xray\xray_',num2str(i),'.jpg'];
B_tmp=load(file_name);
figure(1) imagesc(B_tmp) end
csv_filename = ['C:\Users\Lab\Desktop\xray' filesep 'data.csv']; fp = fopen(csv_filename,'w'); if fp<0 uiwait(msgbox('Cannot create a new CSV file','warning','warn')); return; end
for k = 1:12 fprintf(fp,'%s,%.2f,%.2f,%.2f,%f,%f\n',filenames{k},theta(k),u_off,v_off,I_0(k),1); end
fclose(fp);
acually, i have to put imformation on iamge such as filenames{k},theta(k),u_off,v_off,I_0(k). but first, i cannot load multiple tif or jpg files :(:( could u help me?
  1 commentaire
Jan
Jan le 22 Sep 2011
Please format your code: Follow the "Markup help" link to learn how to do this.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 22 Sep 2011
You can use a cell to store the different images:
b_tmp = cell(1, 12);
for i = 1:12
file_name = ['C:\Users\Lab\Desktop\xray\xray_',num2str(i),'.jpg'];
B_tmp{i} = imread(file_name); % Better than LOAD?!
figure(1)
imagesc(B_tmp{i})
end
I would use IMREAD instead of LOAD to read a JPG file.
Another idea would be to open the CSV file before the loop to read the images and write one line after the other. Then you do not have to keep more than 1 image at the same time in the memory.

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by