use imwrite for images sequence
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Image Analyst
le 5 Fév 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 commentaires
Image Analyst
le 5 Fév 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!