circle.h

00001 
00002 /***************************************************************************
00003  *  circle.h - Header of circle shape model
00004  *
00005  *  Created: Thu May 16 00:00:00 2005
00006  *  Copyright  2005  Tim Niemueller [www.niemueller.de]
00007  *                   Hu Yuxiao      <Yuxiao.Hu@rwth-aachen.de>
00008  *
00009  ****************************************************************************/
00010 
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version. A runtime exception applies to
00015  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Library General Public License for more details.
00021  *
00022  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00023  */
00024 
00025 #ifndef __FIREVISION_MODELS_SHAPE_CIRCLE_H_
00026 #define __FIREVISION_MODELS_SHAPE_CIRCLE_H_
00027 
00028 #include <vector>
00029 #include <iostream>
00030 
00031 #include <utils/math/types.h>
00032 #include <fvutils/base/types.h>
00033 #include <fvutils/base/roi.h>
00034 #include <models/shape/shapemodel.h>
00035 
00036 namespace firevision {
00037 #if 0 /* just to make Emacs auto-indent happy */
00038 }
00039 #endif
00040 
00041 // constants of the limits of the detected ball
00042 const unsigned int TBY_CIRCLE_RADIUS_MAX = 600;
00043 const unsigned int TBY_CIRCLE_RADIUS_MIN = 2;
00044 
00045 class Circle : public Shape
00046 {
00047  public:
00048   Circle();
00049   Circle(const center_in_roi_t& c, float r, int n = 0);
00050 
00051   void printToStream(std::ostream &stream);
00052 
00053   void setMargin( unsigned int margin );
00054   bool isClose( unsigned int in_roi_x, unsigned int in_roi_y );
00055 
00056   void fitCircle(std::vector< fawkes::point_t >& points);
00057 
00058  public:
00059   /** Center of object in ROI */
00060   center_in_roi_t       center;
00061   /** Radius of object */
00062   float                 radius;
00063   /** Number of pixels */
00064   int                   count;
00065   /** Margin around shape */
00066   unsigned int          margin;
00067 
00068 };
00069 
00070 } // end namespace firevision
00071 
00072 #endif // __FIREVISION_MODELS_SHAPE_CIRCLE_H_