Fixed bugs in FernDescriptorMatch and FernClassifier
This commit is contained in:
parent
165f2520c9
commit
15413c8d40
@ -541,7 +541,7 @@ void FernDescriptorMatch::trainFernClassifier()
|
|||||||
vector<int> labels;
|
vector<int> labels;
|
||||||
for( size_t imageIdx = 0; imageIdx < collection.images.size(); imageIdx++ )
|
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++ )
|
for( size_t pointIdx = 0; pointIdx < collection.points[imageIdx].size(); pointIdx++ )
|
||||||
{
|
{
|
||||||
points.push_back(collection.points[imageIdx][pointIdx].pt);
|
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++ )
|
for( i = 0; i < nsamples; i++ )
|
||||||
{
|
{
|
||||||
Point2f pt = points[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];
|
int classId = labels.empty() ? i : labels[i];
|
||||||
if( verbose && (i+1)*progressBarSize/nsamples != i*progressBarSize/nsamples )
|
if( verbose && (i+1)*progressBarSize/nsamples != i*progressBarSize/nsamples )
|
||||||
putchar('.');
|
putchar('.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user