X-Boost  2.3.8
NormalizedHaarFeature.h
Go to the documentation of this file.
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 _NORMALIZED_HAAR_FEATURE_H
22 #define _NORMALIZED_HAAR_FEATURE_H
23 
28 #include "HaarFeature.h"
29 
32 
34  int width, height;
35 
36 public:
37 
39  typedef unsigned int InputDataType;
40 
41 // /// return a float response
42 // typedef float OutputDataType;
43 
44 public:
45 
47 
49  static std::string signature() { return "normalized-haar"; }
50 
51  inline int response(const unsigned int *pIntImage, int stride) const
52  {
53  int value = HaarFeature::response(pIntImage, stride);
54  int factor = pIntImage[-1 - stride] + pIntImage[width + height * stride] - pIntImage[width] - pIntImage[height * stride];
55  return (value * 65536) / factor;
56  }
57 
58 
59  inline int operator() (const unsigned int *pIntImage, int stride) const
60  {
61  return response(pIntImage, stride);
62  }
63 
67  void rescale(int sx, int sy)
68  {
69  HaarFeature::rescale(sx, sy);
70  width = (width * sx + sx - 1);
71  height = (height * sy + sy - 1);
72  }
73 };
74 
75 
76  std::istream & operator >> (std::istream & in, NormalizedHaarFeature & s);
77  std::ostream & operator << (std::ostream & out, const NormalizedHaarFeature & s);
78 
79 #endif
void rescale(int sx, int sy)
Definition: NormalizedHaarFeature.h:67
static std::string signature()
Definition: NormalizedHaarFeature.h:49
A rationale haar feature.
Definition: NormalizedHaarFeature.h:31
unsigned int InputDataType
type of data requested by this Feature Extractor
Definition: NormalizedHaarFeature.h:39
int width
roi
Definition: NormalizedHaarFeature.h:34
void rescale(int sx, int sy)
Definition: HaarFeature.h:141
int response(const unsigned int *pIntImage, int stride) const
Definition: HaarFeature.h:127
An haar Feature: a collection of weighted HaarNode.
Definition: HaarFeature.h:63