1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2008-2012, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other materials provided with the distribution.
27 // * The name of the copyright holders may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
43 #ifndef __SFT_CONFIG_HPP__
44 #define __SFT_CONFIG_HPP__
46 #include <sft/common.hpp>
56 void write(cv::FileStorage& fs) const;
58 void read(const cv::FileNode& node);
60 // Scaled and shrunk model size.
61 cv::Size model(ivector::const_iterator it) const
63 float octave = powf(2.f, (float)(*it));
64 return cv::Size( cvRound(modelWinSize.width * octave) / shrinkage,
65 cvRound(modelWinSize.height * octave) / shrinkage );
68 // Scaled but, not shrunk bounding box for object in sample image.
69 cv::Rect bbox(ivector::const_iterator it) const
71 float octave = powf(2.f, (float)(*it));
72 return cv::Rect( cvRound(offset.x * octave), cvRound(offset.y * octave),
73 cvRound(modelWinSize.width * octave), cvRound(modelWinSize.height * octave));
76 string resPath(ivector::const_iterator it) const
78 return cv::format("%s%d.xml",cascadeName.c_str(), *it);
81 // Paths to a rescaled data
85 // Original model size.
86 cv::Size modelWinSize;
88 // example offset into positive image
91 // List of octaves for which have to be trained cascades (a list of powers of two)
94 // Maximum number of positives that should be used during training
97 // Initial number of negatives used during training.
100 // Number of weak negatives to add each bootstrapping step.
103 // Inverse of scale for feature resizing
106 // Depth on weak classifier's decision tree
109 // Weak classifiers number in resulted cascade
112 // Feature random pool size
115 // file name to store cascade
118 // path to resulting cascade
121 // seed for random generation
124 // channel feature type
127 // // bounding rectangle for actual example into example window
128 // cv::Rect exampleWindow;
131 // required for cv::FileStorage serialization
132 void write(cv::FileStorage& fs, const string&, const Config& x);
133 void read(const cv::FileNode& node, Config& x, const Config& default_value);
134 std::ostream& operator<<(std::ostream& out, const Config& m);