Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
rht_lines.h
1
2
/***************************************************************************
3
* rht_lines.h - Header of lines shape model
4
* using Randomized Hough Transform
5
*
6
* Created: Mon Sep 26 2005 09:48:55
7
* Copyright 2005 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_RHT_LINE_H_
26
#define __FIREVISION_MODELS_SHAPE_RHT_LINE_H_
27
28
#include <vector>
29
#include <iostream>
30
#include <cmath>
31
32
#include <fvutils/base/types.h>
33
#include <fvmodels/shape/line.h>
34
#include <fvmodels/shape/accumulators/ht_accum.h>
35
36
namespace
firevision {
37
#if 0
/* just to make Emacs auto-indent happy */
38
}
39
#endif
40
41
class
ROI;
42
43
class
RhtLinesModel
:
public
ShapeModel
44
{
45
private
:
46
std::vector<LineShape> m_Lines;
47
RhtAccumulator
accumulator;
48
49
public
:
50
/** Creates a new RhtLinesModel instance
51
* @param max_time the maximum runtime of a single parseImage call in seconds,
52
* if you set max_iter to a small number this time may not
53
* be used completely
54
* @param max_iter the maximum number of iterations one parseImage will do,
55
* if you set max_time to a short time this number may not be reached
56
* @param nr_candidates the nr of candidates that is considered per pixel (the hole angle
57
* range is devided in this many parts/lines
58
* @param angle_from The angle to start the candidates from, given in rad, 0 is straight up
59
* @param angle_range the angle range the candidates are taken from starting at angle_from,
60
* given in rad, can be used for example to only search for horizontal lines
61
* @param r_scale This can be done to reduce the size of the hough space and to map more lines
62
* to one line
63
* @param min_votes_ratio The minimum ratio num_votes_per_line/total_num_votes that we have to
64
* have before a point in the hough space is considered to be a line,
65
* this may actually be higher if you use min_votes and set it to a higher
66
* number (set min_votes to 0 to only use min_votes_ration)
67
* @param min_votes the minimum number of votes a point in the hough space has to have before it
68
* is considered to be a line. The number may actually be higher if min_votes_ratio
69
* is set too high (set min_votes_ration to 0 to use only min_votes)
70
*/
71
RhtLinesModel
(
float
max_time = 0.005,
int
max_iter = 1000,
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);
72
virtual
~
RhtLinesModel
(
void
);
73
74
std::string
getName
(
void
)
const
{
return
std::string(
"RhtLinesModel"
);}
75
int
parseImage(
unsigned
char
* buffer,
ROI
*roi);
76
int
getShapeCount(
void
)
const
;
77
LineShape
* getShape(
int
id
)
const
;
78
LineShape
* getMostLikelyShape(
void
)
const
;
79
std::vector< LineShape > * getShapes();
80
81
private
:
82
// The following constants are used as stopping criteria
83
float
RHT_MAX_TIME;
84
int
RHT_MAX_ITER;
85
86
unsigned
int
RHT_NR_CANDIDATES;
87
float
RHT_ANGLE_INCREMENT;
88
float
RHT_ANGLE_FROM;
89
float
RHT_ANGLE_RANGE;
90
91
// The following constants are used for RHT accumulator precision
92
int
RHT_R_SCALE;
93
//const int RHT_PHI_SCALE = 8;
94
95
int
RHT_MIN_VOTES;
96
float
RHT_MIN_VOTES_RATIO;
97
98
unsigned
int
roi_width;
99
unsigned
int
roi_height;
100
101
102
int
diff_sec;
103
int
diff_usec;
104
105
float
f_diff_sec;
106
107
};
108
109
}
// end namespace firevision
110
111
#endif // __FIREVISION_MODELS_SHAPE_RHT_LINES_H_
112
src
libs
fvmodels
shape
rht_lines.h
Generated by
1.8.1.2