Issue #2232: Bugfixes for 64bit Python-compability.

This commit is contained in:
Philipp Wagner
2012-08-06 01:37:43 +02:00
parent 064d022a4b
commit 9db42aca04
3 changed files with 18 additions and 19 deletions

View File

@@ -464,9 +464,12 @@ void Fisherfaces::train(InputArrayOfArrays src, InputArray _lbls) {
// clear existing model data
_labels.release();
_projections.clear();
// get the number of unique classes (provide a cv::Mat overloaded version?)
// safely copy from cv::Mat to std::vector
vector<int> ll;
labels.copyTo(ll);
for(unsigned int i = 0; i < labels.total(); i++) {
ll.push_back(labels.at<int>(i));
}
// get the number of unique classes
int C = (int) remove_dups(ll).size();
// clip number of components to be a valid number
if((_num_components <= 0) || (_num_components > (C-1)))