Image Component Library (ICL)
HoughLineDetector.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLCV/src/ICLCV/HoughLineDetector.h **
10 ** Module : ICLCV **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 
34 #include <cmath>
35 #include <vector>
36 #include <ICLMath/FixedVector.h>
37 #include <ICLUtils/Range.h>
38 #include <ICLUtils/Point.h>
39 #include <ICLUtils/Point32f.h>
40 #include <ICLMath/DynMatrix.h>
41 #include <ICLMath/StraightLine2D.h>
42 #include <ICLCore/Img.h>
43 #include <ICLUtils/Uncopyable.h>
44 #include <ICLUtils/Configurable.h>
45 
46 namespace icl{
47  namespace cv{
48 
110  struct Data;
111  Data *m_data;
112 
113  public:
114 
116 
125  HoughLineDetector(float dRho=0.1, float dR=10,
126  const utils::Range32f &rRange=utils::Range32f(0,::sqrt(640*640+480*480)),
127  float rInhibitionRange=10,
128  float rhoInhibitionRange=0.3,
129  bool gaussianInhibition=true,
130  bool blurHoughSpace=true,
131  bool dilateEntries=true,
132  bool blurredSampling=false);
133 
135 
136 
138  void add(const utils::Point &p);
139 
141  void add(const std::vector<utils::Point> &ps);
142 
144  void add(const utils::Point32f &p);
145 
147  void add(const std::vector<utils::Point32f> &ps);
148 
150  template<class T>
152  add_intern(p[0],p[1]);
153  }
154 
156  template<class T>
157  void add(const std::vector<const math::FixedColVector<T,2> > &ps){
158  for(unsigned int i=0;i<ps.size();++i) add(ps[i]);
159  }
160 
162  void add(const core::Img8u &binaryImage);
163 
165  const core::Img32s &getImage() const;
166 
168  const core::Img32f &getInhibitionMap() const;
169 
171  void reset();
172 
174  std::vector<math::StraightLine2D> getLines(int max, bool resetAfterwards=true);
175 
177 
178  std::vector<math::StraightLine2D> getLines(int max, std::vector<float> &significances, bool resetAfterwards=true);
179 
180  private:
181  void prepare_all();
182 
184  void prepare(float dRho, float dR, const utils::Range32f &rRange,
185  float rInhibitionRange, float rhoInhibitionRange,
186  bool gaussianInhibition=true,
187  bool blurHoughSpace=true,
188  bool dilateEntries=true,
189  bool blurredSampling=false);
190 
192  float r(float rho, float x, float y) const;
193 
195  int getX(float rho) const;
196 
198  int getY(float r) const;
199 
201  float getRho(int x) const;
202 
204  float getR(int y) const;
205 
207  void incLut(float rho, float r);
208 
210  void incLutBlurred(float rho, float r);
211 
213  int &cyclicLUT(int x, int y);
214 
216  void apply_inhibition(const utils::Point &p);
217 
219  void add_intern(float x, float y);
220 
222  void add_intern2(float x, float y);
223 
225  void blur_hough_space_if_necessary();
226 
227  };
228 
229  } // namespace cv
230 }
231 
ICLQt_API ImgQ sqrt(const ImgQ &image)
calls sqrt( each pixel)
undocument this line if you encounter any issues!
Definition: Any.h:37
void add(const std::vector< const math::FixedColVector< T, 2 > > &ps)
adds new points
Definition: HoughLineDetector.h:157
#define ICLCV_API
Definition: CompatMacros.h:177
Definition: HoughLineDetector.h:109
void add(const math::FixedColVector< T, 2 > &p)
adds a new point
Definition: HoughLineDetector.h:151
Single precission 3D Vectors Point class of the ICL.
Definition: Point32f.h:41
Point class of the ICL used e.g. for the Images ROI offset.
Definition: Point.h:58
Interface for classes that can be configured from configuration-files and GUI-Components.
Definition: Configurable.h:194
Definition: FixedVector.h:40
Data * m_data
Definition: HoughLineDetector.h:110