Fixed facerec_eigenfaces.cpp demo sample: it contained hardcoded values, which made wrong element access possible. Fixed unsigned integer/signed integer warnings in facerec.cpp.

This commit is contained in:
Philipp Wagner
2012-07-29 22:41:40 +02:00
parent f160c49473
commit 5983f8008f
2 changed files with 7 additions and 6 deletions

View File

@@ -169,8 +169,9 @@ int main(int argc, const char *argv[]) {
imwrite(format("%s/eigenface_%d.png", output_folder.c_str(), i), norm_0_255(cgrayscale));
}
}
// Display or save the image reconstruction at some predefined steps:
for(int num_components = 10; num_components < 300; num_components+=15) {
for(int num_components = min(W.cols, 10); num_components < min(W.cols, 300); num_components+=15) {
// slice the eigenvectors from the model
Mat evs = Mat(W, Range::all(), Range(0, num_components));
Mat projection = subspaceProject(evs, mean, images[0].reshape(1,1));