Aside: Sorry if I flood SO with OpenCV questions: p
I'm currently trying to port my old code to C in order to use the new C ++ interface, and I got to the point where I was releasing the Eigenfaces face recognition class.
Mat img = imread("1.jpg");
Mat img2 = imread("2.jpg");
FaceDetector* detect = new HaarDetector("haarcascade_frontalface_alt2.xml");
Mat g_img, g_img2;
cvtColor(img, g_img, CV_BGR2GRAY);
cvtColor(img2, g_img2, CV_BGR2GRAY);
Rect r = detect->getFace(g_img);
Mat img_roi = g_img(r);
r = detect->getFace(g_img2);
Mat img2_roi = g_img2(r);
Mat data;
data.create(2,1, img2_roi.type());
data.row(0) = img_roi;
data.row(1) = img2_roi;
Mat averageFace;
PCA pca(data, averageFace, CV_PCA_DATA_AS_ROW, 2);
I am trying to create a PCA space and then see if it works by showing the calculated average image. Are there any other steps to this?
Perhaps I need to project images onto the PCA subspace first?
source
share