store result to xml.

pull/322/head
marina.kolpakova 12 years ago
parent bfa26fd447
commit a89299acb2
  1. 7
      apps/sft/include/sft/config.hpp
  2. 1
      apps/sft/include/sft/octave.hpp
  3. 5
      apps/sft/octave.cpp
  4. 7
      apps/sft/sft.cpp

@ -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;

@ -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;

@ -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)
{

@ -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);
}
}

Loading…
Cancel
Save