title: Save opencv descriptor matcher after training with Ferns descriptor
body: <p>I am working in a image recognition application and trying to implement a method using the Ferns descriptor matcher.</p>
  
  <p>I training the Ferns structures and saving them using the code below:</p>
  
  <pre><code>int main(int argc, char** argv) {
  
  
  vector&lt;string&gt; trainFilenames;
  readTrainFilenames(modelImagesList, imagesDir, trainFilenames);
  
  Ptr&lt;GenericDescriptorMatcher&gt; descriptorMatcher = GenericDescriptorMatcher::create("FERN", params_filename);
  
  SurfFeatureDetector detector(500);
  SurfDescriptorExtractor extractor;
  
  vector&lt;vector&lt;KeyPoint&gt; &gt; allKeypoints;
  vector&lt;Mat&gt; allTrainImages;
  
  //TRAIN AND SAVE
  for(unsigned int i = 0; i &lt; trainFilenames.size(); i++){
  
      Mat sceneImage;
      std::vector&lt;KeyPoint&gt; sceneKeypoints;
  
      sceneImage = imread(trainFilenames.at(i), CV_LOAD_IMAGE_GRAYSCALE );
  
      detector.detect( sceneImage, sceneKeypoints );
  
      allKeypoints.push_back(sceneKeypoints);
      allTrainImages.push_back(sceneImage);
  }
  
  std::string sceneImageData = "sceneImagedatamodel.xml";
  FileStorage fs(sceneImageData, FileStorage::WRITE);
  
  descriptorMatcher-&gt;add(allTrainImages, allKeypoints);
  
  descriptorMatcher-&gt;train(); 
  descriptorMatcher-&gt;write(fs);
  
  fs.release();   
  </code></pre>
  
  <p>}</p>
  
  <p>However, the only thing I obtain in the output file is this:</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
  &lt;opencv_storage&gt;
  &lt;nclasses&gt;0&lt;/nclasses&gt;
  &lt;patchSize&gt;31&lt;/patchSize&gt;
  &lt;signatureSize&gt;2147483647&lt;/signatureSize&gt;
  &lt;nstructs&gt;50&lt;/nstructs&gt;
  &lt;structSize&gt;9&lt;/structSize&gt;
  &lt;nviews&gt;1000&lt;/nviews&gt;
  &lt;compressionMethod&gt;0&lt;/compressionMethod&gt;
  &lt;/opencv_storage&gt;
  </code></pre>
  
  <p>Wasn't I supposed to save the entire structure in the xml file?</p>
  
  <p>I can't seem to find any where someone doing this with the new C++ interface. Are these methods really working? If so, do you guys have any idea how to put it to work?</p>
  
  <p>Thank you.</p>