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 <fvmodels/shape/circle.h>
30 #include <fvutils/base/types.h>
31 #include <utils/math/types.h>
32 
33 #include <iostream>
34 #include <vector>
35 
36 namespace firevision {
37 
38 class ROI;
39 
40 class RcdCircleModel : public ShapeModel
41 {
42 private:
43  std::vector<Circle> m_Circles;
44 
45 public:
46  RcdCircleModel(unsigned int max_failures = 300,
47  unsigned int min_pixels = 20,
48  unsigned int min_interpix_dist = 10,
49  unsigned int max_dist_p4 = 2,
50  unsigned int max_dist_a = 10,
51  float hw_ratio = 0.6,
52  float hollow_rate = 0.f,
53  float max_time = 0.01);
54  virtual ~RcdCircleModel(void);
55 
56  std::string
57  getName(void) const
58  {
59  return std::string("RcdCircleModel");
60  }
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  int diff_sec;
76  int diff_usec;
77  float f_diff_sec;
78 
79  unsigned int RCD_MAX_FAILURES;
80  unsigned int RCD_MIN_PIXELS;
81  unsigned int RCD_MIN_INTERPIX_DIST;
82  unsigned int RCD_MAX_DIST_P4;
83  unsigned int RCD_MAX_DIST_A;
84  float RCD_HW_RATIO;
85  float RCD_MAX_TIME;
86  float RCD_ROI_HOLLOW_RATE;
87 };
88 
89 } // end namespace firevision
90 
91 #endif
firevision::Circle
Circle shape.
Definition: circle.h:43
firevision::RcdCircleModel::RcdCircleModel
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:63
firevision::RcdCircleModel::~RcdCircleModel
virtual ~RcdCircleModel(void)
Destrcutor.
Definition: rcd_circle.cpp:83
fawkes::upoint_t
Point with cartesian coordinates as unsigned integers.
Definition: types.h:35
firevision::RcdCircleModel::parseImage
int parseImage(unsigned char *buffer, ROI *roi)
Parse image for given ROI.
Definition: rcd_circle.cpp:89
firevision::ROI
Region of interest.
Definition: roi.h:55
firevision::RcdCircleModel::getName
std::string getName(void) const
Get name of shape model.
Definition: rcd_circle.h:57
firevision::ShapeModel
Shape model interface.
Definition: shapemodel.h:46
firevision::RcdCircleModel::getShape
Circle * getShape(int id) const
Get specific shape.
Definition: rcd_circle.cpp:313
firevision::RcdCircleModel::getShapeCount
int getShapeCount(void) const
Get number of shapes.
Definition: rcd_circle.cpp:307
firevision::RcdCircleModel::getMostLikelyShape
Circle * getMostLikelyShape(void) const
Get best candidate.
Definition: rcd_circle.cpp:323
firevision::center_in_roi_t
Center in ROI.
Definition: types.h:38
firevision::RcdCircleModel
RCD circle model from the following literature An Efficient Randomized Algorithm for Detecting Circle...
Definition: rcd_circle.h:41