scanlinemodel.h

00001
00002 /***************************************************************************
00003  *  scanlinemodel.h - Abstract class defining a scanline model
00004  *
00005  *  Generated: 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 /** @class ScanlineModel <models/scanlines/scanlinemodel.h>
00040  * Scanline model interface.
00041  * This interface defines the API for the scanline model. A scanline model
00042  * determines a specific set of points in the image that should be used for image
00043  * evaluation if using all the pixels of an image would take too long.
00044  * This is one of the major optimizations throughout FireVision to ensure high
00045  * speed image processing.
00046  *
00047  * @author Tim Niemueller
00048  */
00049
00050 class ScanlineModel
00051 {
00052
00053  public:
00054   /** Virtual empty destructor. */
00055   virtual ~ScanlineModel() {}
00056 
00057   /** Get the current coordinate.
00058    * @return current point in image that is shall be processed.
00059    */
00060   virtual fawkes::point_t    operator*()                                    = 0;
00061 
00062   /** Get pointer to current point.
00063    * @return pointer to current point
00064    * @see operator*()
00065    */
00066   virtual fawkes::point_t *  operator->()                                   = 0;
00067 
00068   /** Postfix ++ operator.
00069    * Advances to the next point and returns the new point.
00070    * @return pointer to new point
00071    */
00072   virtual fawkes::point_t *  operator++()                                   = 0;
00073 
00074   /** Prefix ++ operator.
00075    * Advances to the next point but returns the old point.
00076    */
00077   virtual fawkes::point_t *  operator++(int)                                = 0;
00078 
00079   /** Check if all desired points have been processed.
00080    * @return true if all pixels that the model defines have been iterated.
00081    */
00082   virtual bool          finished()                                     = 0;
00083 
00084   /** Reset model.
00085    * Resets the set of processed points.
00086    */
00087   virtual void          reset()                                        = 0;
00088 
00089   /** Get name of scanline model.
00090    * @return name of scanline model.
00091    */
00092   virtual const char *  get_name()                                     = 0;
00093
00094 
00095   /** Get margin around points.
00096    * Models that do not use margins shall return zero.
00097    * It shall be guaranteed that in this margin
00098    * region around a point there is no other point that has been or will be
00099    * returned in a full iteration.
00100    * @return margin around a point.
00101    */
00102   virtual unsigned int  get_margin()                                   = 0;
00103 
00104   /** Set the robot's pose.
00105    * @param x robot's x coordinate on field in meters
00106    * @param y robot's y coordinate on field in meters
00107    * @param ori robot's orientation. Looking towards the opponent goal is zero
00108    * rad, with positive values pointing to the right, negative to the left.
00109    */
00110   virtual void          set_robot_pose(float x, float y, float ori)    = 0;
00111 
00112   /** Set camera's pan/tilt values.
00113    * @param pan camera's current pan
00114    * @param tilt camera's current tilt
00115    */
00116   virtual void          set_pan_tilt(float pan, float tilt)            = 0;
00117 
00118   /** Set the region-of-interest.
00119    * If not NULL the scanlines gets only calculated within the ROI
00120    * @param roi the region where scanlines should be calculated
00121    */
00122   virtual void          set_roi(ROI* roi = NULL) { throw fawkes::NotImplementedException("Setting ROI is not implemented."); }
00123 };
00124
00125 #endif