How to assign a numeric value to a picture file?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
ok so im having a problem with converting a file to numeric value. i have used str2num and has given me no luck. what i want to do is basically make a picture file for example x.gif equal to 1. I have multiple .gif files and want to assign values to each .gif file. how would i do this? thanks.
0 Commenti
Risposta accettata
Image Analyst
il 23 Apr 2014
Jack, we're not sure what you want. So you read in your gif file
myGif = imread('x.gif');
Now you have all the pixels in the myGif array. So what do you want to do with that? Assign all the values to 1?
myGif(:) = 1; % Assign all pixels a value of 1, erasing previous values.
Why would you want to do that???
To process a sequence of files, see the FAQ for code samples: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
2 Commenti
Image Analyst
il 24 Apr 2014
Jack, regarding your "Answer" how about this:
filenames = dir('*.gif')
for k = 1 : length(filenames)
filenames(k).number = k;
end
Now every filename has a number associated with it. Of course it's just the same as the index so it's totally unnecessary, but it seems like that's what you want for some reason.
Più risposte (2)
Vedere anche
Categorie
Scopri di più su File Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!