Fawkes API  Fawkes Development Version
ht_lines.h
1 
2 /***************************************************************************
3  * ht_lines.h - Header of lines shape model
4  * using Hough Transform
5  *
6  * Created: Fri Jan 13 12:40:57 2006
7  * Copyright 2005-2006 Tim Niemueller [www.niemueller.de]
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version. A runtime exception applies to
15  * this software (see LICENSE.GPL_WRE file mentioned below for details).
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23  */
24 
25 #ifndef _FIREVISION_MODELS_SHAPE_HT_LINE_H_
26 #define _FIREVISION_MODELS_SHAPE_HT_LINE_H_
27 
28 #include <fvmodels/shape/accumulators/ht_accum.h>
29 #include <fvmodels/shape/line.h>
30 #include <fvutils/base/types.h>
31 
32 #include <cmath>
33 #include <iostream>
34 #include <vector>
35 
36 namespace firevision {
37 
38 class ROI;
39 
40 class HtLinesModel : public ShapeModel
41 {
42 private:
43  std::vector<LineShape> m_Lines;
44  RhtAccumulator accumulator;
45 
46 public:
47  HtLinesModel(unsigned int nr_candidates = 40,
48  float angle_from = 0,
49  float angle_range = 2 * M_PI,
50  int r_scale = 1,
51  float min_votes_ratio = 0.2f,
52  int min_votes = -1);
53  virtual ~HtLinesModel(void);
54 
55  std::string
56  getName(void) const
57  {
58  return std::string("RhtLinesModel");
59  }
60  int parseImage(unsigned char *buffer, ROI *roi);
61  int getShapeCount(void) const;
62  LineShape * getShape(int id) const;
64  std::vector<LineShape> *getShapes();
65 
66 private:
67  unsigned int RHT_NR_CANDIDATES;
68  float RHT_ANGLE_INCREMENT;
69  float RHT_ANGLE_FROM;
70  float RHT_ANGLE_RANGE;
71 
72  // The following constants are used for RHT accumulator precision
73  int RHT_R_SCALE;
74  //const int RHT_PHI_SCALE = 8;
75 
76  int RHT_MIN_VOTES;
77  float RHT_MIN_VOTES_RATIO;
78 
79  unsigned int roi_width;
80  unsigned int roi_height;
81 };
82 
83 } // end namespace firevision
84 
85 #endif // FIREVISION_MODELS_SHAPE_HT_LINES_H__
firevision::HtLinesModel::parseImage
int parseImage(unsigned char *buffer, ROI *roi)
Definition: ht_lines.cpp:86
firevision::HtLinesModel::getMostLikelyShape
LineShape * getMostLikelyShape(void) const
Definition: ht_lines.cpp:171
firevision::ROI
Definition: roi.h:60
firevision::HtLinesModel::HtLinesModel
HtLinesModel(unsigned int nr_candidates=40, float angle_from=0, float angle_range=2 *M_PI, int r_scale=1, float min_votes_ratio=0.2f, int min_votes=-1)
Constructor.
Definition: ht_lines.cpp:60
firevision::HtLinesModel::getShapeCount
int getShapeCount(void) const
Definition: ht_lines.cpp:155
firevision::LineShape
Definition: line.h:47
firevision::HtLinesModel::getName
std::string getName(void) const
Definition: ht_lines.h:63
firevision::HtLinesModel::~HtLinesModel
virtual ~HtLinesModel(void)
Destructor.
Definition: ht_lines.cpp:80
firevision::HtLinesModel::getShape
LineShape * getShape(int id) const
Definition: ht_lines.cpp:161
firevision::HtLinesModel::getShapes
std::vector< LineShape > * getShapes()
Get all lines found.
Definition: ht_lines.cpp:192