Creating a csv file by loading multiple images in matlab -


i working on machine learning problem of classifying different types of leaves using flavia dataset. have dataset folder has 32 sub folders each containing images of respective class. images grayscale of dimension 4096x1. how can load these images subfolders @ once , create csv file stored pixel values ?

create cell array filenames, e.g.

c{1} = '/path/to/file1.png'; c{2} = '/path/to/file2.png'; 

etc. (there several ways automatically, given have no information on file structure , there aren't many files, let's skip step. )

then have loop

for n = 1 : 32   = imread(c{n});   csvwrite('my_csv_file.csv', i(:).', '-append'); end 

ps. (:).' syntax ensures each image becomes row.


Comments