Azzera filtri
Azzera filtri

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

6 visualizzazioni (ultimi 30 giorni)
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 Commento
Jan
Jan il 22 Set 2011
Please format your code: Follow the "Markup help" link to learn how to do this.

Accedi per commentare.

Risposte (1)

Jan
Jan il 22 Set 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.

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by