split public interface and realization for SoftCascadeOctave

This commit is contained in:
marina.kolpakova
2013-01-29 17:44:21 +04:00
parent f3227c3f1a
commit 4ba8b53152
5 changed files with 92 additions and 55 deletions

View File

@@ -43,6 +43,7 @@
// Trating application for Soft Cascades.
#include <sft/common.hpp>
#include <iostream>
#include <sft/fpool.hpp>
#include <sft/config.hpp>
@@ -127,22 +128,24 @@ int main(int argc, char** argv)
cv::Rect boundingBox = cfg.bbox(it);
std::cout << "Object bounding box" << boundingBox << std::endl;
cv::SoftCascadeOctave boost(boundingBox, npositives, nnegatives, *it, shrinkage);
typedef cv::SoftCascadeOctave Octave;
cv::Ptr<Octave> boost = Octave::create(boundingBox, npositives, nnegatives, *it, shrinkage);
std::string path = cfg.trainPath;
sft::ScaledDataset dataset(path, *it);
if (boost.train(&dataset, &pool, cfg.weaks, cfg.treeDepth))
if (boost->train(&dataset, &pool, cfg.weaks, cfg.treeDepth))
{
CvFileStorage* fout = cvOpenFileStorage(cfg.resPath(it).c_str(), 0, CV_STORAGE_WRITE);
boost.write(fout, cfg.cascadeName);
boost->write(fout, cfg.cascadeName);
cvReleaseFileStorage( &fout);
cv::Mat thresholds;
boost.setRejectThresholds(thresholds);
boost->setRejectThresholds(thresholds);
boost.write(fso, &pool, thresholds);
boost->write(fso, &pool, thresholds);
cv::FileStorage tfs(("thresholds." + cfg.resPath(it)).c_str(), cv::FileStorage::WRITE);
tfs << "thresholds" << thresholds;