Commit 15413c8d authored by Ilya Lysenkov's avatar Ilya Lysenkov

Fixed bugs in FernDescriptorMatch and FernClassifier

parent 165f2520
......@@ -541,7 +541,7 @@ void FernDescriptorMatch::trainFernClassifier()
vector<int> labels;
for( size_t imageIdx = 0; imageIdx < collection.images.size(); imageIdx++ )
{
refimgs[imageIdx] = &collection.images[imageIdx];
refimgs[imageIdx] = new Mat (collection.images[imageIdx]);
for( size_t pointIdx = 0; pointIdx < collection.points[imageIdx].size(); pointIdx++ )
{
points.push_back(collection.points[imageIdx][pointIdx].pt);
......
......@@ -853,7 +853,7 @@ void FernClassifier::train(const vector<Point2f>& points,
for( i = 0; i < nsamples; i++ )
{
Point2f pt = points[i];
const Mat& src = *refimgs[i];
const Mat& src = labels.empty() ? *refimgs[i] : *refimgs[labels[i]];
int classId = labels.empty() ? i : labels[i];
if( verbose && (i+1)*progressBarSize/nsamples != i*progressBarSize/nsamples )
putchar('.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment