필터 지우기
필터 지우기

Problem with imwrite

조회 수: 1 (최근 30일)
Jessica
Jessica 2012년 4월 12일
Dear Sir,
i am trying to use imwrite to save some images i selected from my database to put them in a new folder
i used this : image2= imread(['C:\Database\',num2str(x(i)),'.jpg']);
imwrite(image2,fullfile(cd, strcat('C:\Results\',image2,'.jpg')));
would you guide me to solve this?
Thank you
  댓글 수: 1
Jan
Jan 2012년 4월 12일
You forgot to explain the problem.

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

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 4월 12일
try
fullfile(cd, strcat('Results\',num2str(x(i)),'.jpg'))
  댓글 수: 4
Jessica
Jessica 2012년 4월 12일
yes what andrei told me to do worked but now i have the error above
Walter Roberson
Walter Roberson 2012년 4월 12일
You missed the strcat() step, Jessica.

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

추가 답변 (1개)

Jan
Jan 2012년 4월 12일
This is not valid:
fullfile(cd, strcat('C:\Results\',image2,'.jpg'))
While cd is the current directory, you cannot append the path 'C:\...'. Most likely you want:
fullfile('C:', 'Results', [image2, '.jpg'])
or directly:
['C:\Results\', image2, '.jpg']
to construct the file name.
  댓글 수: 1
Image Analyst
Image Analyst 2012년 4월 12일
Or (my favorite) use sprintf() to construct your base filename:
baseFileName = sprintf('Results %d.PNG', imageNumber);
fullFileName = fullfile(folder, baseFileName);
Note that I use PNG for lossless compression and better saved image quality, rather than JPG.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by