How to store images and its labels in a struct array?
Afficher commentaires plus anciens
I am doing Image classification task. I have total 500 folders and under each folder i have three image files as nifti file format. My first target here is store all the images in a single cell array (1*1500) in a simplest way. Next is to create a structure array together this original image files and the labels. Any help is appreciated!
Thanks
3 commentaires
Image Analyst
le 11 Sep 2017
I REALLY doubt you need to do that even though you think you do. I never do. Why do you think you need to do that, rather than just read and process one image at a time?
By the way, a structure array is different than a cell array. See the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
OCDER
le 11 Sep 2017
How about starting directly from a structure? Saves you from using a cell2struct command.
S(1:1500) = struct('Image', [], 'Label', '')
for j = 1:length(S)
S(j).Image = %Read the jth image
S(j).Label = 'some kind of label';
end
Réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!