필터 지우기
필터 지우기

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

조회 수: 6 (최근 30일)
Beyung Doo Jo
Beyung Doo Jo 2011년 9월 22일
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
Jan
Jan 2011년 9월 22일
Please format your code: Follow the "Markup help" link to learn how to do this.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2011년 9월 22일
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.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by