How to save series of images?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Steven
am 18 Dez. 2013
Bearbeitet: Steven
am 18 Dez. 2013
Hi.
I am reading and doing a bunch of stuff on a series of images.
But I want to save every thing done on every image for future use. How can I do so?
I mean, for example, I have read 100 images and just turn them into binary. How can I save all of them in binary in the workspace for further use?
By saving I do not mean writing the images, I mean keep them in the memory and workspace.
I can't use something like
. . .
binaryImage (i) = ... (i is the index of the loop in which the process is done)
because it confuses with dimensions of the image.
What can I do?
Thanks a lot.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 18 Dez. 2013
Steven/Mohammad:
If you have a script, then any variables are left hanging around in the base workspace. If they are in a function, then vanish when the function exits. To use variables in a function in the future elsewhere, you need to return them as output arguments. Or else use the methods described in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
By the way if you want to save images in a loop, you need to save either to a 3D array
if i == 1
binaryImage3D = thisBinaryImage; % The first time, initialize
else
binaryImage3D = cat(3, binaryImage3D, thisBinaryImage);
end
or save it into a cell of a cell array where you use braces instead of parentheses.
allBinaryImages{i} = thisBinaryImage;
You can read the FAQ on cell arrays for a good description of cell arrays: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
2 Kommentare
Image Analyst
am 18 Dez. 2013
1. You need to have i be the last index, not the first. And you don't need the (:,:) on the array:
allBinaryImages(:, :, i) = thisBinaryImage;
To show one particular plane from that 3D image, you'd select it
imshow(allBinaryImages(:,:, 42)); % Show image #42.
2. I don't take email. The email account I used for this account is a temporary one that I never monitor, can't take attachments to, and can't reply from. It's just a spam catcher account, as you can see by going to mailinator.com and typing in imageanalyst. Anyone, even you, can login with no password and see all the complete garbage that I'd be getting in my mail email if I had used that. You can replay here and there's a 95% chance I'll see it.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Code Generation, GPU, and Third-Party Support 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!