FLANN save/load (Bug #210)


Added by Amir Rosenfeld almost 15 years ago. Updated over 13 years ago.


Status:Done Start date:
Priority:Normal Due date:
Assignee:Marius Muja % Done:

0%

Category:flann
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

OpenCV enables saving and loading the flann index to/from a file (using SavedIndexParams). However when loading, not only is the index loaded (as it should be), it is also re-built. The result is inefficiency. This can be avoided by a simple check.


Associated revisions

Revision 1cf0bef6
Added by Vadim Pisarevsky over 10 years ago

Merge pull request #210 from akarsakov:fix_cvtcolor_luv_rgb

History

Updated by takuya minagawa about 14 years ago

FYI
I encountered the same problem. I could avoid this problem by changing flann.cpp from:

Index::Index(const Matrix<float>& dataset, const [[IndexParams]]& params)
{
    nnIndex = params.createIndex(dataset);
    nnIndex->buildIndex();
}

to:

Index::Index(const Matrix<float>& dataset, const [[IndexParams]]& params)
{
    nnIndex = params.createIndex(dataset);
    if(typeid(params)!=typeid(SavedIndexParams))
        nnIndex->buildIndex();
}

Updated by Vadim Pisarevsky almost 14 years ago

  • Status deleted (Open)

Updated by Marius Muja over 13 years ago

Index is not rebuilt is the parameters are of type SavedIndexParams. See flann_base.hpp in Index<T>::Index(...) and Index<T>::buildIndex().

  • Status set to Done
  • (deleted custom field) set to invalid

Also available in: Atom PDF