hsdharam
(Hrishikesh Dharam)
January 24, 2015, 10:04pm
1
files = Import[“~/blog/faces94/male”][[1 ;; -1 ;; 30]];
faces = Map[Import[“~/blog/faces94/male/” <> #] &, files];
I can’t find any documentation that explains how to use Import in this way.
I’m trying to use the notebook from this website: Eigenfaces, for Facial Recognition || Math ∩ Programming
The github page is here: GitHub - j2kun/eigenfaces: Mathematica notebook and resources for the post "Eigenfaces" · GitHub
nma
(Nasser M. Abbasi)
January 24, 2015, 10:26pm
2
files = Import[“~/blog/faces94/male”][[1 ;; -1 ;; 30]];
The call Import["~/blog/faces94/male"] reads the names of all the files in the folder ~/blog/faces94/male. Then they filter it out using [[1 ;; -1 ;; 30]]; which I find strange way of doing it. I do not know why they did not use FileNames[] for this part.
SetDirectory[NotebookDirectory[]];
dim = {200, 180};
files = Import["faces94/male"][[1 ;; -1 ;; 30]]
faces = Map[Import["~/blog/faces94/male/" <> #] &, files];
This line imports each image from the list of the files from the above operation. Now all these images are stored in faces list
faces = Map[Import["faces94/male/" <> #] &, files];
Length[faces]
(*76*)