use imwrite for images sequence
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Soum
am 5 Feb. 2014
Kommentiert: Image Analyst
am 5 Feb. 2014
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
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 5 Feb. 2014
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 Kommentare
Image Analyst
am 5 Feb. 2014
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!