Skip to content

Instantly share code, notes, and snippets.

@anupkalburgi
Last active August 29, 2015 14:17
Show Gist options
  • Save anupkalburgi/bd1ebb373dcb04649189 to your computer and use it in GitHub Desktop.
Save anupkalburgi/bd1ebb373dcb04649189 to your computer and use it in GitHub Desktop.
library(pixmap)
face_vectors <- function (filenames){
list_faces <- list()
for( i in seq_along(filenames)){
img <- read.pnm(filenames[i])
new_face <- as.vector(t(img@grey))
list_faces <- c(list_faces ,new_face )
#C <- matrix(as.vector(img@grey), nrow=( dim(img@grey)[1] * dim(img@grey)[2] ), ncol=1)
}
return(list_faces)
}
filenames <- list.files("~/rproject/faces94/male", pattern="*.pbm", full.names=TRUE, recursive = TRUE)
print(face_vectors(filenames))
https://www.dropbox.com/s/u7u67ps14hbjbpq/pbm.zip?dl=0
@anupkalburgi
Copy link
Author

@anupkalburgi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment