store result to xml.
authormarina.kolpakova <marina.kolpakova@itseez.com>
Fri, 7 Dec 2012 14:26:09 +0000 (18:26 +0400)
committermarina.kolpakova <marina.kolpakova@itseez.com>
Fri, 1 Feb 2013 10:34:39 +0000 (14:34 +0400)
apps/sft/include/sft/config.hpp
apps/sft/include/sft/octave.hpp
apps/sft/octave.cpp
apps/sft/sft.cpp

index 6e512be..d0ede66 100644 (file)
@@ -73,6 +73,13 @@ struct Config
             cvRound(modelWinSize.width  * octave), cvRound(modelWinSize.height * octave));
     }
 
+    string resPath(ivector::const_iterator it) const
+    {
+        char s[65];
+        sprintf(s, "%d", *it);
+        return std::string(cascadeName) + s + ".xml";
+    }
+
     // Paths to a rescaled data
     string trainPath;
     string testPath;
index e03c29e..08c258b 100644 (file)
@@ -129,6 +129,7 @@ public:
     virtual ~Octave();
 
      virtual bool train(const Dataset& dataset, const FeaturePool& pool, int weaks, int treeDepth);
+     virtual void write( CvFileStorage* fs, string name) const;
 
     int logScale;
 
index e90504f..4cb301e 100644 (file)
@@ -297,6 +297,11 @@ bool sft::Octave::train(const Dataset& dataset, const FeaturePool& pool, int wea
 
 }
 
+void sft::Octave::write( CvFileStorage* fs, string name) const
+{
+    CvBoost::write(fs, name.c_str());
+}
+
 // ========= FeaturePool ========= //
 sft::FeaturePool::FeaturePool(cv::Size m, int n) : model(m), nfeatures(n)
 {
index 6ea3513..c68a24a 100644 (file)
@@ -46,6 +46,8 @@
 #include <sft/octave.hpp>
 #include <sft/config.hpp>
 
+#include <opencv2/core/core_c.h>
+
 int main(int argc, char** argv)
 {
     using namespace sft;
@@ -128,7 +130,10 @@ int main(int argc, char** argv)
         if (boost.train(dataset, pool, cfg.weaks, cfg.treeDepth))
         {
             std::cout << "Octave " << *it << " was successfully trained..." << std::endl;
-    //         strong.push_back(octave);
+             CvFileStorage* fout = cvOpenFileStorage(cfg.resPath(it).c_str(), 0, CV_STORAGE_WRITE);
+             boost.write(fout, cfg.cascadeName);
+            // strong.push_back(octave);
+             cvReleaseFileStorage( &fout);
         }
     }