Fawkes API  Fawkes Development Version
scanlinemodel.h
00001 
00002 /***************************************************************************
00003  *  scanlinemodel.h - Abstract class defining a scanline model
00004  *
00005  *  Created: Tue May 03 19:50:02 2005
00006  *  Copyright  2005-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __FIREVISION_MODELS_SCANLINES_SCANLINEMODEL_H_
00025 #define __FIREVISION_MODELS_SCANLINES_SCANLINEMODEL_H_
00026 
00027 
00028 /* IMPORTANT IMPLEMENTATION NOTE:
00029  * Do _not_ split this into a .h and .cpp file. This interface is used in fvutils.
00030  * The only way to allows this circular dependency is to have this as a plain
00031  * header that does not require any linking. Thus you may not split the file.
00032  */
00033 
00034 #include <core/exceptions/software.h>
00035 #include <fvutils/base/types.h>
00036 #include <fvutils/base/roi.h>
00037 #include <string>
00038 
00039 namespace firevision {
00040 #if 0 /* just to make Emacs auto-indent happy */
00041 }
00042 #endif
00043 
00044 /** @class ScanlineModel <fvmodels/scanlines/scanlinemodel.h>
00045  * Scanline model interface.
00046  * This interface defines the API for the scanline model. A scanline model
00047  * determines a specific set of points in the image that should be used for image
00048  * evaluation if using all the pixels of an image would take too long.
00049  * This is one of the major optimizations throughout FireVision to ensure high
00050  * speed image processing.
00051  *
00052  * @author Tim Niemueller
00053  */
00054 
00055 class ScanlineModel
00056 {
00057 
00058  public:
00059   /** Virtual empty destructor. */
00060   virtual ~ScanlineModel() {}
00061 
00062   /** Get the current coordinate.
00063    * @return current point in image that is shall be processed.
00064    */
00065   virtual fawkes::point_t    operator*()                                    = 0;
00066 
00067   /** Get pointer to current point.
00068    * @return pointer to current point
00069    * @see operator*()
00070    */
00071   virtual fawkes::point_t *  operator->()                                   = 0;
00072 
00073   /** Postfix ++ operator.
00074    * Advances to the next point and returns the new point.
00075    * @return pointer to new point
00076    */
00077   virtual fawkes::point_t *  operator++()                                   = 0;
00078 
00079   /** Prefix ++ operator.
00080    * Advances to the next point but returns the old point.
00081    * @return pointer to next point
00082    */
00083   virtual fawkes::point_t *  operator++(int)                                = 0;
00084 
00085   /** Check if all desired points have been processed.
00086    * @return true if all pixels that the model defines have been iterated.
00087    */
00088   virtual bool          finished()                                     = 0;
00089 
00090   /** Reset model.
00091    * Resets the set of processed points.
00092    */
00093   virtual void          reset()                                        = 0;
00094 
00095   /** Get name of scanline model.
00096    * @return name of scanline model.
00097    */
00098   virtual const char *  get_name()                                     = 0;
00099 
00100 
00101   /** Get margin around points.
00102    * Models that do not use margins shall return zero.
00103    * It shall be guaranteed that in this margin
00104    * region around a point there is no other point that has been or will be
00105    * returned in a full iteration.
00106    * @return margin around a point.
00107    */
00108   virtual unsigned int  get_margin()                                   = 0;
00109 
00110   /** Set the robot's pose.
00111    * @param x robot's x coordinate on field in meters
00112    * @param y robot's y coordinate on field in meters
00113    * @param ori robot's orientation. Looking towards the opponent goal is zero
00114    * rad, with positive values pointing to the right, negative to the left.
00115    */
00116   virtual void          set_robot_pose(float x, float y, float ori)    = 0;
00117 
00118   /** Set camera's pan/tilt values.
00119    * @param pan camera's current pan
00120    * @param tilt camera's current tilt
00121    */
00122   virtual void          set_pan_tilt(float pan, float tilt)            = 0;
00123 
00124   /** Set the region-of-interest.
00125    * If not NULL the scanlines gets only calculated within the ROI
00126    * @param roi the region where scanlines should be calculated
00127    */
00128   virtual void          set_roi(ROI* roi = NULL) { throw fawkes::NotImplementedException("Setting ROI is not implemented."); }
00129 };
00130 
00131 } // end namespace firevision
00132 
00133 #endif