Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ContourDetectorBase.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #ifndef __ContourDetectorBase_hh__
27 #define __ContourDetectorBase_hh__
28 
29 #include <bias_config.h>
30 #include <string>
31 #include <Base/Image/Image.hh>
32 #include <Base/Math/Vector2.hh>
33 
34 
35 namespace BIAS {
36 
37  /** @class BIASContour
38  @author ischiller
39  @brief This class describes a contour using the freemancode. */
40  class BIASFeatureDetector_EXPORT BIASContour{
41 
42  public:
43  BIASContour() {length =0;};
45  /** \brief All pixels contained in the contour. */
46  std::vector<BIAS::Vector2<double> > contourPixel;
47  /** \brief The direction from the first to the second pixel
48  is the first value in freemanCode list of difference vectors
49  coded in FreeManCode, that means: <br>
50  0 = step right --<br>
51  1 = step right & step down --<br>
52  2 = step down --<br>
53  3 = step left & step down --<br>
54  ... --<br>
55  6 = step up --<br>
56  7 = step right & step up<br> */
57  std::vector<int> freemanCode;
58  unsigned length;
59  } ;
60 
61 
62  /**
63  @class ContourDetectorBase
64  @ingroup g_feature
65  @brief purely virtual interface defining class for contour detectors
66  @author ischiller 08/2008
67  */
68  template <class StorageType>
69  class BIASFeatureDetector_EXPORT ContourDetectorBase : public Debug
70  {
71  public:
73  virtual ~ContourDetectorBase();
74 
75  /** purely virtual interface definition */
76  virtual int Detect(Image<StorageType>& image,
77  std::vector<BIAS::BIASContour>& contours)=0;
78 
79  ///////////////////////////////////////////////////////////////////////
80 
81  inline void SetMaxNumContours(const int maxnum){
82  dMaxNumContours_ = maxnum;
83  }
84 
85  /** @brief return maximum number of contours
86  @author ischiller */
87  inline int GetMaxNumContours(){
88  return dMaxNumContours_;
89  }
90 
91  protected:
92 
93  /// maximum number of corners to return
95 
96  std::vector<BIAS::BIASContour> detectedContours_;
97  }; // class
98 
99 
100 } // namespace
101 
102 #endif // __ContourDetectorBase_hh__
This class describes a contour using the freemancode.
std::vector< int > freemanCode
The direction from the first to the second pixel is the first value in freemanCode list of difference...
std::vector< BIAS::BIASContour > detectedContours_
int dMaxNumContours_
maximum number of corners to return
The image template class for specific storage types.
Definition: Image.hh:78
int GetMaxNumContours()
return maximum number of contours
purely virtual interface defining class for contour detectors
void SetMaxNumContours(const int maxnum)