Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to save and load FlannBasedMatcher


Training an OpenCV DescriptorMatcher can be a time consuming operation if the training image set is large.Reference to this post

There exists read and write method to load and save FlannBasedMatcher.

   virtual void read( const FileNode& );

   virtual void write( FileStorage& ) const;

I try this method and find that the trained DescriptorMatcher data is strange.My code is

    FlannBasedMatcher matcher;
    FileStorage matcher_fs(matcher_string.c_str(), FileStorage::WRITE); 

    vector<Mat> ref_his_vector;


Mat ref_his is defined above

And the result on the disk is

image description

In fact,trainning data in the FlannBasedMatcher exists 154 descriptors

image description

I'm not sure whether there is anything wrong with my code.My opencv version is 2.4.2.