Fawkes API Fawkes Development Version
ht_accum.h
1
2/***************************************************************************
3 * ht_accum.h - Accumulator class for HoughTransform
4 *
5 * Created: Tue Jun 28 00:00:00 2005
6 * Copyright 2005 Hu Yuxiao <Yuxiao.Hu@rwth-aachen.de>
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#ifndef _FIREVISION_MODELS_SHAPE_ACCUMULATORS_HT_ACCUM_H_
25#define _FIREVISION_MODELS_SHAPE_ACCUMULATORS_HT_ACCUM_H_
26
27#include <ostream>
28#include <stdlib.h>
29#include <vector>
30
31namespace firevision {
32
34{
35public:
36 RhtAccNode();
37 virtual ~RhtAccNode();
38 virtual void clear(int ignore);
39
40protected:
41 /** left */
43 /** right */
45 /** used for recycling */
47};
48
49class RhtRNode : public RhtAccNode
50{
51public:
52 RhtRNode(int r);
53 void clear(void);
54 int insert(int r);
55 void dump(std::ostream &, int x, int y);
56 void clear(int r);
57 void getNodes(std::vector<std::vector<int>> *rv, int min_votes, int x, int y);
58
59 static RhtRNode *generate(int r);
60 static void reset(void);
61 static void cleanup(void);
62
63protected:
64 /** r */
65 int r;
66 /** count */
67 int count;
68
69private:
70 static RhtRNode *reuse_head;
71 static RhtRNode *reuse_tail;
72};
73
74class RhtYNode : public RhtAccNode
75{
76private:
77 static RhtYNode *reuse_head;
78 static RhtYNode *reuse_tail;
79
80public:
81 static RhtYNode *generate(int y);
82 static void reset(void);
83 static void cleanup(void);
84
85protected:
86 /** y */
87 int y;
88 /** r_root */
90
91public:
92 RhtYNode(int y);
93 int insert(int y, int r);
94 void dump(std::ostream &, int x);
95 void clear(int y);
96 void getNodes(std::vector<std::vector<int>> *rv, int min_votes, int x);
97};
98
99class RhtXNode : public RhtAccNode
100{
101private:
102 static RhtXNode *reuse_head;
103 static RhtXNode *reuse_tail;
104
105public:
106 static RhtXNode *generate(int x);
107 static void reset(void);
108 static void cleanup(void);
109
110protected:
111 /** x */
112 int x;
113 /** y root */
115
116public:
117 RhtXNode(int x);
118 int insert(int x, int y, int r);
119 void dump(std::ostream &);
120 void clear(int x);
121 void getNodes(std::vector<std::vector<int>> *rv, int min_votes);
122};
123
125{
126private:
127 int x_max;
128 int y_max;
129 int r_max;
130 int max;
131
132 RhtXNode *root;
133
134 int num_votes;
135
136public:
139 int accumulate(int x, int y, int r);
140 int getMax(int &x, int &y, int &r) const;
141 void dump(std::ostream &);
142 void reset(void);
143 unsigned int getNumVotes() const;
144 std::vector<std::vector<int>> *getNodes(int min_count);
145};
146
147} // end namespace firevision
148
149#endif
Hough-Transform accumulator node.
Definition: ht_accum.h:34
RhtAccNode * left
left
Definition: ht_accum.h:42
RhtAccNode()
Constructor.
Definition: ht_accum.cpp:59
virtual void clear(int ignore)
Clear.
Definition: ht_accum.cpp:73
RhtAccNode * next
used for recycling
Definition: ht_accum.h:46
RhtAccNode * right
right
Definition: ht_accum.h:44
virtual ~RhtAccNode()
Destructor.
Definition: ht_accum.cpp:65
Hough-Transform accumulator.
Definition: ht_accum.h:125
unsigned int getNumVotes() const
Get number of votes.
Definition: ht_accum.cpp:513
int getMax(int &x, int &y, int &r) const
Get maximum.
Definition: ht_accum.cpp:491
void reset(void)
Reset.
Definition: ht_accum.cpp:451
std::vector< std::vector< int > > * getNodes(int min_count)
Get nodes.
Definition: ht_accum.cpp:523
int accumulate(int x, int y, int r)
Accumulate new candidate.
Definition: ht_accum.cpp:468
~RhtAccumulator()
Destructor.
Definition: ht_accum.cpp:442
void dump(std::ostream &)
Dump.
Definition: ht_accum.cpp:503
RhtAccumulator()
Constructor.
Definition: ht_accum.cpp:435
Hough-Transform accumulator node.
Definition: ht_accum.h:50
int insert(int r)
Insert.
Definition: ht_accum.cpp:330
void clear(void)
Clear.
Definition: ht_accum.cpp:320
static RhtRNode * generate(int r)
Generate.
Definition: ht_accum.cpp:390
RhtRNode(int r)
Constructor.
Definition: ht_accum.cpp:312
void dump(std::ostream &, int x, int y)
Dump.
Definition: ht_accum.cpp:376
static void reset(void)
Reset.
Definition: ht_accum.cpp:418
static void cleanup(void)
Cleanup.
Definition: ht_accum.cpp:425
void getNodes(std::vector< std::vector< int > > *rv, int min_votes, int x, int y)
Get nodes.
Definition: ht_accum.cpp:352
Hough-Transform accumulator node.
Definition: ht_accum.h:100
void clear(int x)
Clear.
Definition: ht_accum.cpp:168
int insert(int x, int y, int r)
Insert node.
Definition: ht_accum.cpp:94
static void reset(void)
Reset.
Definition: ht_accum.cpp:177
static void cleanup(void)
Cleanup.
Definition: ht_accum.cpp:184
RhtXNode(int x)
Constructor.
Definition: ht_accum.cpp:81
static RhtXNode * generate(int x)
Generate.
Definition: ht_accum.cpp:149
RhtYNode * y_root
y root
Definition: ht_accum.h:114
void dump(std::ostream &)
Dump to stream.
Definition: ht_accum.cpp:135
void getNodes(std::vector< std::vector< int > > *rv, int min_votes)
Get nodes.
Definition: ht_accum.cpp:116
Hough-Transform accumulator node.
Definition: ht_accum.h:75
static RhtYNode * generate(int y)
Generate.
Definition: ht_accum.cpp:265
RhtRNode * r_root
r_root
Definition: ht_accum.h:89
void getNodes(std::vector< std::vector< int > > *rv, int min_votes, int x)
Get nodes.
Definition: ht_accum.cpp:231
void clear(int y)
Clear.
Definition: ht_accum.cpp:284
static void reset(void)
Reset.
Definition: ht_accum.cpp:293
void dump(std::ostream &, int x)
Dump.
Definition: ht_accum.cpp:251
RhtYNode(int y)
Constructor.
Definition: ht_accum.cpp:196
static void cleanup(void)
Cleanup.
Definition: ht_accum.cpp:300
int insert(int y, int r)
Insert.
Definition: ht_accum.cpp:208