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
36namespace firevision {
37
38class ROI;
39
41{
42private:
43 std::vector<LineShape> m_Lines;
44 RhtAccumulator accumulator;
45
46public:
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;
63 LineShape * getMostLikelyShape(void) const;
64 std::vector<LineShape> *getShapes();
65
66private:
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__
Hough-Transform line matcher.
Definition: ht_lines.h:41
virtual ~HtLinesModel(void)
Destructor.
Definition: ht_lines.cpp:80
LineShape * getMostLikelyShape(void) const
Get best candidate.
Definition: ht_lines.cpp:171
LineShape * getShape(int id) const
Get specific shape.
Definition: ht_lines.cpp:161
std::string getName(void) const
Get name of shape model.
Definition: ht_lines.h:56
int getShapeCount(void) const
Get number of shapes.
Definition: ht_lines.cpp:155
int parseImage(unsigned char *buffer, ROI *roi)
Parse image for given ROI.
Definition: ht_lines.cpp:86
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
std::vector< LineShape > * getShapes()
Get all lines found.
Definition: ht_lines.cpp:192
Line shape.
Definition: line.h:41
Region of interest.
Definition: roi.h:55
Hough-Transform accumulator.
Definition: ht_accum.h:125
Shape model interface.
Definition: shapemodel.h:46