Fawkes API  Fawkes Development Version
rcd_circle.h
1 
2 /***************************************************************************
3  * rcd_circle.h - Header of circle shape model
4  * using Random Circle Detection Algorithm
5  *
6  * Created: Thu May 16 00:00:00 2005
7  * Copyright 2005 Tim Niemueller [www.niemueller.de]
8  * Hu Yuxiao <Yuxiao.Hu@rwth-aachen.de>
9  *
10  ****************************************************************************/
11 
12 /* This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version. A runtime exception applies to
16  * this software (see LICENSE.GPL_WRE file mentioned below for details).
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Library General Public License for more details.
22  *
23  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
24  */
25 
26 #ifndef __FIREVISION_MODELS_SHAPE_RCD_CIRCLE_H_
27 #define __FIREVISION_MODELS_SHAPE_RCD_CIRCLE_H_
28 
29 #include <vector>
30 #include <iostream>
31 
32 #include <utils/math/types.h>
33 #include <fvutils/base/types.h>
34 #include <fvmodels/shape/circle.h>
35 
36 namespace firevision {
37 #if 0 /* just to make Emacs auto-indent happy */
38 }
39 #endif
40 
41 class ROI;
42 
44 {
45  private:
46  std::vector<Circle> m_Circles;
47  public:
48 
49  RcdCircleModel(unsigned int max_failures = 300,
50  unsigned int min_pixels = 20,
51  unsigned int min_interpix_dist = 10,
52  unsigned int max_dist_p4 = 2,
53  unsigned int max_dist_a = 10,
54  float hw_ratio = 0.6,
55  float hollow_rate = 0.f,
56  float max_time = 0.01
57  );
58  virtual ~RcdCircleModel(void);
59 
60  std::string getName(void) const {return std::string("RcdCircleModel");}
61  int parseImage(unsigned char* buffer, ROI *roi);
62  int getShapeCount(void) const;
63  Circle* getShape(int id) const;
64  Circle* getMostLikelyShape(void) const;
65 
66  private:
67  /** Calculate circle from three points
68  */
69  void calcCircle( const fawkes::upoint_t& p1,
70  const fawkes::upoint_t& p2,
71  const fawkes::upoint_t& p3,
72  center_in_roi_t& center,
73  float& radius);
74 
75 
76 
77  int diff_sec;
78  int diff_usec;
79  float f_diff_sec;
80 
81  unsigned int RCD_MAX_FAILURES;
82  unsigned int RCD_MIN_PIXELS;
83  unsigned int RCD_MIN_INTERPIX_DIST;
84  unsigned int RCD_MAX_DIST_P4;
85  unsigned int RCD_MAX_DIST_A;
86  float RCD_HW_RATIO;
87  float RCD_MAX_TIME;
88  float RCD_ROI_HOLLOW_RATE;
89 
90 };
91 
92 } // end namespace firevision
93 
94 #endif
95 
virtual ~RcdCircleModel(void)
Destrcutor.
Definition: rcd_circle.cpp:88
Circle * getMostLikelyShape(void) const
Get best candidate.
Definition: rcd_circle.cpp:329
int getShapeCount(void) const
Get number of shapes.
Definition: rcd_circle.cpp:312
std::string getName(void) const
Get name of shape model.
Definition: rcd_circle.h:60
Region of interest.
Definition: roi.h:58
Circle shape.
Definition: circle.h:45
RCD circle model from the following literature An Efficient Randomized Algorithm for Detecting Circle...
Definition: rcd_circle.h:43
int parseImage(unsigned char *buffer, ROI *roi)
Parse image for given ROI.
Definition: rcd_circle.cpp:93
RcdCircleModel(unsigned int max_failures=300, unsigned int min_pixels=20, unsigned int min_interpix_dist=10, unsigned int max_dist_p4=2, unsigned int max_dist_a=10, float hw_ratio=0.6, float hollow_rate=0.f, float max_time=0.01)
Create a new circle model which uses RCD to detect circles.
Definition: rcd_circle.cpp:65
Circle * getShape(int id) const
Get specific shape.
Definition: rcd_circle.cpp:317
Point with cartesian coordinates as unsigned integers.
Definition: types.h:34
Center in ROI.
Definition: types.h:39
Shape model interface.
Definition: shapemodel.h:49