我可以找到单个图像的PCA吗? - MATLAB

Sid*_*Sid 6 matlab image-processing feature-extraction pca

我正在使用PCA和SVM进行人脸识别.我的训练集有400个图像阵列,我已经在其上执行了PCA并将数据映射到本征空间.现在进行测试我只有一个图像,其主要组件我需要提取以匹配先前提取的功能.但是我使用的任何PCA算法甚至内置命令(princomp)都会出现尺寸错误.因为PCA需要形成本征空间并将数据投影到这个空间,我如何形成单个图像的本征空间?

phy*_*rox 3

您应该使用通过训练数据获得的相同特征空间。

这里有一个很好解释的教程。主要步骤如下:

训练:

% step: 1: find the mean image
mean_face = mean(images, 2);
% step 3 : calculate the eigenvectors and eigenvalues
[evectors, score, evalues] = princomp(images');
Run Code Online (Sandbox Code Playgroud)

测试:

% calculate the feture vector
feature_vec = evectors' * (input_image(:) - mean_face);
Run Code Online (Sandbox Code Playgroud)

正如您所看到的evectors,并且mean_face是在训练阶段进行计算的。