Principal Component Analysis |
This application implements the principal component analysis (PCA) described in VisualFeatures.htm. In the training mode it calculates the eigenvalues and eigenvectors of the covariance of all the images in the input AVI sequences. In the projection mode it maps the images in the test AVI sequences to the eigen-space obtained in the training mode.
Training mode:
pca.exe -train <AVI file folder> <result file> <subspace
dim>
<AVI file folder> a folder that contains the input AVI files. The AVI files should be the uncompressed format.
<result file> the output file (text format) that contains the eigenvalues, eigenvectors and the mean vector obtained in training.
<subspace dim> the dimension of the subspace obtained by the PCA. In other words, it represents the numbers of eigenvalues and the corresponding eigenvectors stored in the result data file. For the numeric string data, 32 is recommended.
Projection mode:
pca.exe -proj <PCA data file> <AVI file folder> <result
file folder>
<PCA data file> data file obtained in training mode. The file contains the eigenvectors, eigenvalues and the mean vector obtained from the training sequences.
<AVI file folder> directory that contains the input AVI files. The AVI files should be the uncompressed format. File test01.avi is a sample AVI file. The video sequence contains 64×64 gray scale images. In the current system the images are downsampled to 32×32 before PCA.
<result file folder> directory that contains the PCA projection files. Each file corresponds to one input AVI file, e.g. for input file test01.avi, the result file is test01.pmfc. The projection file is a binary file with the following format:
[nSamples] [samplePeriod] [sampleSize] [paramKind] [data body], where
[nSamples] 4-byte integer that indicates the number of the data vectors in the file
[samplePeriod] 4-byte integer that indicates the sample period in 100ns units, e.g. for 25Hz video it should be 400000.
[sampleSize] 2-byte integer that indicates the size of data vector in bytes. For the n-dimensional vector, it should be n×sizeof (float).
[paramKind] 2-byte integer that indicates the type of the data file, be set to 99.
[float data] 4-byte float data that is stored vector by vector. For the m n-dimensional data vectors, there should be m×n float data.