Fawkes API  Fawkes Development Version
scanlinemodel.h
1 
2 /***************************************************************************
3  * scanlinemodel.h - Abstract class defining a scanline model
4  *
5  * Created: Tue May 03 19:50:02 2005
6  * Copyright 2005-2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _FIREVISION_MODELS_SCANLINES_SCANLINEMODEL_H_
25 #define _FIREVISION_MODELS_SCANLINES_SCANLINEMODEL_H_
26 
27 /* IMPORTANT IMPLEMENTATION NOTE:
28  * Do _not_ split this into a .h and .cpp file. This interface is used in fvutils.
29  * The only way to allows this circular dependency is to have this as a plain
30  * header that does not require any linking. Thus you may not split the file.
31  */
32 
33 #include <core/exceptions/software.h>
34 #include <fvutils/base/roi.h>
35 #include <fvutils/base/types.h>
36 
37 #include <string>
38 
39 namespace firevision {
40 
41 /** @class ScanlineModel <fvmodels/scanlines/scanlinemodel.h>
42  * Scanline model interface.
43  * This interface defines the API for the scanline model. A scanline model
44  * determines a specific set of points in the image that should be used for image
45  * evaluation if using all the pixels of an image would take too long.
46  * This is one of the major optimizations throughout FireVision to ensure high
47  * speed image processing.
48  *
49  * @author Tim Niemueller
50  */
51 
53 {
54 public:
55  /** Virtual empty destructor. */
56  virtual ~ScanlineModel()
57  {
58  }
59 
60  /** Get the current coordinate.
61  * @return current point in image that is shall be processed.
62  */
63  virtual fawkes::upoint_t operator*() = 0;
64 
65  /** Get pointer to current point.
66  * @return pointer to current point
67  * @see operator*()
68  */
69  virtual fawkes::upoint_t *operator->() = 0;
70 
71  /** Postfix ++ operator.
72  * Advances to the next point and returns the new point.
73  * @return pointer to new point
74  */
75  virtual fawkes::upoint_t *operator++() = 0;
76 
77  /** Prefix ++ operator.
78  * Advances to the next point but returns the old point.
79  * @return pointer to next point
80  */
81  virtual fawkes::upoint_t *operator++(int) = 0;
82 
83  /** Check if all desired points have been processed.
84  * @return true if all pixels that the model defines have been iterated.
85  */
86  virtual bool finished() = 0;
87 
88  /** Reset model.
89  * Resets the set of processed points.
90  */
91  virtual void reset() = 0;
92 
93  /** Get name of scanline model.
94  * @return name of scanline model.
95  */
96  virtual const char *get_name() = 0;
97 
98  /** Get margin around points.
99  * Models that do not use margins shall return zero.
100  * It shall be guaranteed that in this margin
101  * region around a point there is no other point that has been or will be
102  * returned in a full iteration.
103  * @return margin around a point.
104  */
105  virtual unsigned int get_margin() = 0;
106 
107  /** Set the robot's pose.
108  * @param x robot's x coordinate on field in meters
109  * @param y robot's y coordinate on field in meters
110  * @param ori robot's orientation. Looking towards the opponent goal is zero
111  * rad, with positive values pointing to the right, negative to the left.
112  */
113  virtual void set_robot_pose(float x, float y, float ori) = 0;
114 
115  /** Set camera's pan/tilt values.
116  * @param pan camera's current pan
117  * @param tilt camera's current tilt
118  */
119  virtual void set_pan_tilt(float pan, float tilt) = 0;
120 
121  /** Set the region-of-interest.
122  * If not NULL the scanlines gets only calculated within the ROI
123  * @param roi the region where scanlines should be calculated
124  */
125  virtual void
126  set_roi(ROI *roi = NULL)
127  {
128  throw fawkes::NotImplementedException("Setting ROI is not implemented.");
129  }
130 };
131 
132 } // end namespace firevision
133 
134 #endif
Called method has not been implemented.
Definition: software.h:105
Region of interest.
Definition: roi.h:55
Scanline model interface.
Definition: scanlinemodel.h:53
virtual ~ScanlineModel()
Virtual empty destructor.
Definition: scanlinemodel.h:56
virtual fawkes::upoint_t operator*()=0
Get the current coordinate.
virtual fawkes::upoint_t * operator++()=0
Postfix ++ operator.
virtual void set_robot_pose(float x, float y, float ori)=0
Set the robot's pose.
virtual void set_pan_tilt(float pan, float tilt)=0
Set camera's pan/tilt values.
virtual void reset()=0
Reset model.
virtual unsigned int get_margin()=0
Get margin around points.
virtual const char * get_name()=0
Get name of scanline model.
virtual bool finished()=0
Check if all desired points have been processed.
virtual fawkes::upoint_t * operator->()=0
Get pointer to current point.
virtual fawkes::upoint_t * operator++(int)=0
Prefix ++ operator.
virtual void set_roi(ROI *roi=NULL)
Set the region-of-interest.
Point with cartesian coordinates as unsigned integers.
Definition: types.h:35