필터 지우기
필터 지우기

use imwrite for images sequence

조회 수: 3 (최근 30일)
Soum
Soum 2014년 2월 5일
댓글: Image Analyst 2014년 2월 5일
Hi ;
I'm trying to save my data 'Images' after some treatment by using imwrite but the problem is
that imwrite does not work for a sequence, I've read some solutions and tried them but they
don't work this is how i wrote my code for EX:
%read the sequence
for i=1:k
%treatment
Id{k} = waverec2(t_C,L,'sym8');
fileName = sprintf('C:\\Users\\swings\\Desktop\\data\\imagesPourAlgo\\images.tiff\\%02d',k);
imwrite ( Id, 'fileName', 'tif');
end
knowing that I want to save 'write' each image separately for doing another process on them
thanks in advance

채택된 답변

Image Analyst
Image Analyst 2014년 2월 5일
Get rid of the {k} from ld{k}. You don't need it unless you want to keep all of the images after your for loop exits for some reason. And if you did, then you'd have to change it to ld{i} since i is the loop index, not k. k is just the stopping index and never changes.
By the say, you can use forward slashes for folder dividers, even with Windows, if that makes it simpler for you.
  댓글 수: 3
Soum
Soum 2014년 2월 5일
Sorry,I did a mistake I've written i instead of k it's like this %read the sequence
for k=1:37
%treatment
Id{k} = waverec2(t_C,L,'sym8');
fileName = sprintf('C:\\Users\\swings\\Desktop\\data\\imagesPourAlgo\\images.tiff\\%02d',k);
imwrite ( Id, 'fileName', 'tif');
end I used {} because I read a sequence of images from 1 to 37
Image Analyst
Image Analyst 2014년 2월 5일
You don't have to type it in again, you know. All computer have a copy and paste capability. Learn about it if you don't yet. Also, read this to learn how to format your code: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
But anyway, if you are going to be using your Id after your for loop exits, then you also need the {k} in the write statement:
fileName = sprintf('C:/Users/swings/Desktop/data/imagesPourAlgo/images.tiff/%02d.tif',k);
imwrite (Id{k}, fileName);
Also, don't put filename in quotes and you don't need tif if you just include an extension.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by