PCA: Performs principle component analysis for image files

Description Usage Arguments Details Value References Examples

View source: R/imageset_ef.R

Description

Calculates the data covariance matrix of the original data. Returns eigenvectors (and eigenvalues) of the covariance matrix as an 'imageset_ef' object.

Usage

1
PCA(td, showEigenvals = TRUE, quick = FALSE)

Arguments

td

an object of class 'imageset_ef', training data.

showEigenvals

logical vector (TRUE or FALSE).

quick

logical vector (TRUE or FALSE).

Details

td is the 'imageset_ef'-object where the images are saved as 'image_ef' objects. showEigenvals determins whether the eigenvalues are returned in addition to the eigenvectors (FALSE means only the eigenvectors are returned). When the number of pixels of each images is much bigger than the number of images in td it is faster to diagonalize t(A) %*% A instead of the covariance matrix. However, this causes that only a subset of the eigenvectors of the covariance matrix is returned. If quick is set TRUE, this option is activated.

Value

list of length 1 (when showEigenvals <- FALSE; contains an 'imageset_ef' object consisting of the eigenvectors as 'image_ef' objects) or 2 (when showEigenvals <- TRUE; additionally contains a list of the eigenvalues).

References

Marinovsky F., Wagner P., Gesichtserkennung mit Eigenfaces, FH Zittau/Görlitz

Examples

1
2
3
4
# Import Olivetti-faces
olivetti <- system.file("extdata","olivetti_X.csv",package="eigenfaces")
td <- load_imageset_ef(olivetti, c(64,64))
PCA(td, showEigenvals = FALSE, quick=TRUE)

Osburg/eigenfaces documentation built on Aug. 26, 2020, 4:41 p.m.