Merge pull request #255 from taka-no-me:fix_batchdist_test

This commit is contained in:
Andrey Kamaev 2012-12-24 13:29:32 +04:00 committed by OpenCV Buildbot
commit 524bde2aeb

View File

@ -150,7 +150,7 @@ void generateData( Mat& query, Mat& train, const int sourceType )
// in ascending order. General boundaries of the perturbation
// are (0.f, 1.f).
train.create( query.rows*countFactor, query.cols, sourceType );
float step = 1.f / countFactor;
float step = (sourceType == CV_8U ? 256.f : 1.f) / countFactor;
for( int qIdx = 0; qIdx < query.rows; qIdx++ )
{
Mat queryDescriptor = query.row(qIdx);
@ -161,7 +161,7 @@ void generateData( Mat& query, Mat& train, const int sourceType )
queryDescriptor.copyTo( trainDescriptor );
int elem = rng(dim);
float diff = rng.uniform( step*c, step*(c+1) );
trainDescriptor.at<float>(0, elem) += diff;
trainDescriptor.col(elem) += diff;
}
}
}