Borrar filtros
Borrar filtros

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

6 visualizaciones (últimos 30 días)
Beyung Doo Jo
Beyung Doo Jo el 22 de Sept. de 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 comentario
Jan
Jan el 22 de Sept. de 2011
Please format your code: Follow the "Markup help" link to learn how to do this.

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 22 de Sept. de 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.

Categorías

Más información sobre Environment and Settings 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!

Translated by