rcd_circle.h

00001 
00002 /***************************************************************************
00003  *  rcd_circle.h - Header of circle shape model
00004  *                 using Random Circle Detection Algorithm
00005  *
00006  *  Created: Thu May 16 00:00:00 2005
00007  *  Copyright  2005  Tim Niemueller [www.niemueller.de]
00008  *                   Hu Yuxiao      <Yuxiao.Hu@rwth-aachen.de>
00009  *
00010  ****************************************************************************/
00011 
00012 /*  This program is free software; you can redistribute it and/or modify
00013  *  it under the terms of the GNU General Public License as published by
00014  *  the Free Software Foundation; either version 2 of the License, or
00015  *  (at your option) any later version. A runtime exception applies to
00016  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00017  *
00018  *  This program is distributed in the hope that it will be useful,
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *  GNU Library General Public License for more details.
00022  *
00023  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00024  */
00025 
00026 #ifndef __FIREVISION_MODELS_SHAPE_RCD_CIRCLE_H_
00027 #define __FIREVISION_MODELS_SHAPE_RCD_CIRCLE_H_
00028 
00029 #include <vector>
00030 #include <iostream>
00031 
00032 #include <utils/math/types.h>
00033 #include <fvutils/base/types.h>
00034 #include <models/shape/circle.h>
00035 
00036 namespace firevision {
00037 #if 0 /* just to make Emacs auto-indent happy */
00038 }
00039 #endif
00040 
00041 class ROI;
00042 
00043 class RcdCircleModel: public ShapeModel
00044 {
00045  private:
00046   std::vector<Circle> m_Circles;
00047  public:
00048 
00049   RcdCircleModel(unsigned int max_failures       = 300,
00050                  unsigned int min_pixels         =  20,
00051                  unsigned int min_interpix_dist  =  10,
00052                  unsigned int max_dist_p4        =   2,
00053                  unsigned int max_dist_a         =  10,
00054                  float        hw_ratio           =   0.6,
00055                  float        hollow_rate        =   0.f,
00056                  float        max_time           =   0.01
00057                  );
00058   virtual ~RcdCircleModel(void);
00059 
00060   std::string   getName(void) const {return std::string("RcdCircleModel");}
00061   int           parseImage(unsigned char* buffer, ROI *roi);
00062   int           getShapeCount(void) const;
00063   Circle*       getShape(int id) const;
00064   Circle*       getMostLikelyShape(void) const;
00065   
00066  private:
00067   /** Calculate circle from three points
00068    */
00069   void          calcCircle( const fawkes::point_t& p1,
00070                             const fawkes::point_t& p2,
00071                             const fawkes::point_t& p3,
00072                             center_in_roi_t& center,
00073                             float& radius);
00074 
00075 
00076 
00077   int    diff_sec;
00078   int    diff_usec;
00079   float  f_diff_sec;
00080 
00081   unsigned int  RCD_MAX_FAILURES;
00082   unsigned int  RCD_MIN_PIXELS;
00083   unsigned int  RCD_MIN_INTERPIX_DIST;
00084   unsigned int  RCD_MAX_DIST_P4;
00085   unsigned int  RCD_MAX_DIST_A;
00086   float         RCD_HW_RATIO;
00087   float         RCD_MAX_TIME;
00088   float         RCD_ROI_HOLLOW_RATE;
00089 
00090 };
00091 
00092 } // end namespace firevision
00093 
00094 #endif
00095