X-Boost  2.3.8
RealToDiscrete.h
1 /* XBoost: Ada-Boost and Friends on Haar/ICF/HOG Features, Library and ToolBox
2  *
3  * Copyright (c) 2008-2014 Paolo Medici <medici@ce.unipr.it>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef _real_to_discrete_h
22 #define _real_to_discrete_h
23 // parked here
24 
26 template<class Classifier>
27 struct RealToDiscrete : public Classifier {
28 
29 public:
30 
31  typedef Classifier FeatureType;
32 
33 public:
34 
35  RealToDiscrete(const Classifier & x) : Classifier(x) { }
36  RealToDiscrete() { }
37  ~RealToDiscrete() { }
38 
40  const char *str() const {return Classifier::name; }
41 
43  static std::string signature() { return Classifier::signature() + "-discrete"; }
44 
48  inline int classify(const unsigned int *pIntImage, int stride) const
49  {
50  return ((Classifier::classify(pIntImage, stride) ) > 0.0) ? 1 : -1;
51  }
52 
54  inline int operator()(const unsigned int *pIntImage, int stride) const
55  {
56  return classify(pIntImage, stride );
57  }
58 
59 };
60 
61 #endif
static std::string signature()
signature name is the name of provider (for simplicity)
Definition: RealToDiscrete.h:43
int classify(const unsigned int *pIntImage, int stride) const
Definition: RealToDiscrete.h:48
Definition: RealToDiscrete.h:27
const char * str() const
return the "feature" name (for debug purpose)
Definition: RealToDiscrete.h:40
int operator()(const unsigned int *pIntImage, int stride) const
classify wrapper.
Definition: RealToDiscrete.h:54