Reputation: 609
I try to do this face recognition example, with Eigenfaces. And cannot understand what these functions subspaceProject() and subspaceReconstruct() actually do. I tried to search on http://docs.opencv.org/ but there was not any link to description.
Could you explain me what this part of the code actually do?
Mat evs = Mat(W, Range::all(), Range(0, num_components));
Mat projection = subspaceProject(evs, mean, images[0].reshape(1,1));
Mat reconstruction = subspaceReconstruct(evs, mean, projection);
// Normalize the result:
reconstruction = norm_0_255(reconstruction.reshape(1, images[0].rows));
I mean what these functions do, what kind of cv::Mat they return ?
Upvotes: 1
Views: 1036
Reputation: 11941
subspaceProject()
will basically give you a dimensionality reduction.
projection = (images[0] - mean) * evs
Subtracting the mean ensures that the images approximate a subspace. Presumably evs is the truncated right singular vectors.
and for subspaceReconstruct()
reconstruction = projection * transpose(evs) + mean
The reconstruction is just the reverse of the projection, except since evs is truncated, it can not be perfect.
See PCA
Upvotes: 1