Auto save file name by using original name
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm using the Image Processing Toolbox for MATLAB to do analysis on some images. I want to create a loop so that I can process multiple files. At the end of the loop, I will be plotting some images onto one figure. Then, I want to save it with the original filename, and add "-XYZ" at the end.
Is there a way to make this process automatic, so the script will perform the required analysis, plot the images, save, then move on to the next image? Also, is there a way to create an excel or txt document at the end of each image analysis?
Right now my code looks like:
originalImage = imread('file.jpg');
bw = im2bw(originalImage, 0.85);
a = bwarea(bw)
b = bwarea(~bw)
h = figure
subplot(1,3,1), imshow(originalImage), title('A')
subplot(1,3,2), imshow(bw); title('B')
subplot(1,3,3), imshow(~bw); title('C')
print(h, '-dtiff ', 'test');
0 Commenti
Risposte (3)
Gerd
il 16 Giu 2011
Hi takem,
do to the fact you have the handle to your new figure you can use
saveas(h,[filepath '\' Savefilename Savefileextension],'jpg');
You have to use the filepath and filename from which you loaded your original image and append your application specific comment.
Gerd
Walter Roberson
il 16 Giu 2011
I guess you realized by now that the solution to the question you deleted was:
Do not im2bw(fullFileName, 0.85) -- instead im2bw(imageArray, 0.85)
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!