Fawkes API  Fawkes Development Version
line_grid.h
1 
2 /***************************************************************************
3  * line_grid.h - Scanline model implementation: line grid
4  *
5  * Created: Wen Mar 25 17:31:00 2009
6  * Copyright 2009 Christof Rath <c.rath@student.tugraz.at>
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_SCANLINE_LINE_GRID_H_
25 #define _FIREVISION_SCANLINE_LINE_GRID_H_
26 
27 #include "scanlinemodel.h"
28 
29 #include <fvutils/base/types.h>
30 #include <fvutils/color/yuv.h>
31 
32 #include <list>
33 
34 namespace firevision {
35 
36 class ROI;
37 
38 class ScanlineLineGrid : public ScanlineModel
39 {
40 private:
41  typedef std::list<fawkes::upoint_t> point_list_t;
42 
43 public:
44  ScanlineLineGrid(unsigned int width,
45  unsigned int height,
46  unsigned int offset_hor,
47  unsigned int offset_ver,
48  ROI * roi = NULL,
49  unsigned int gap = 0);
50  virtual ~ScanlineLineGrid();
51 
56 
57  bool finished();
58  void reset();
59  const char * get_name();
60  unsigned int get_margin();
61 
62  virtual void set_robot_pose(float x, float y, float ori);
63  virtual void set_pan_tilt(float pan, float tilt);
64 
65  virtual void set_dimensions(unsigned int width, unsigned int height, ROI *roi = NULL);
66  virtual void set_offset(unsigned int offset_x, unsigned int offset_y);
67  virtual void set_grid_params(unsigned int width,
68  unsigned int height,
69  unsigned int offset_hor,
70  unsigned int offset_ver,
71  ROI * roi = NULL);
72  virtual void set_roi(ROI *roi = NULL);
73 
74 private:
75  unsigned int width_;
76  unsigned int height_;
77  unsigned int offset_ver_;
78  unsigned int offset_hor_;
79  unsigned int next_pixel_;
80 
81  ROI *roi_;
82 
83  point_list_t point_list_;
84  point_list_t::iterator cur_;
85 
86  void calc_coords();
87 };
88 
89 } // end namespace firevision
90 
91 #endif //FIREVISION_SCANLINE_LINE_GRID_H__
firevision::ScanlineLineGrid::~ScanlineLineGrid
virtual ~ScanlineLineGrid()
Destructor.
Definition: line_grid.cpp:70
firevision::ScanlineLineGrid::set_roi
virtual void set_roi(ROI *roi=NULL)
Sets the region-of-interest.
Definition: line_grid.cpp:226
firevision::ScanlineLineGrid::ScanlineLineGrid
ScanlineLineGrid(unsigned int width, unsigned int height, unsigned int offset_hor, unsigned int offset_ver, ROI *roi=NULL, unsigned int gap=0)
Constructor.
Definition: line_grid.cpp:55
firevision::ScanlineLineGrid::set_offset
virtual void set_offset(unsigned int offset_x, unsigned int offset_y)
Sets offset.
Definition: line_grid.cpp:261
firevision::ScanlineLineGrid::reset
void reset()
Reset model.
Definition: line_grid.cpp:173
firevision::ScanlineLineGrid::set_pan_tilt
virtual void set_pan_tilt(float pan, float tilt)
Set camera's pan/tilt values.
Definition: line_grid.cpp:197
firevision::ScanlineLineGrid::set_grid_params
virtual void set_grid_params(unsigned int width, unsigned int height, unsigned int offset_hor, unsigned int offset_ver, ROI *roi=NULL)
Set all grid parameters.
Definition: line_grid.cpp:283
fawkes::upoint_t
Point with cartesian coordinates as unsigned integers.
Definition: types.h:33
firevision::ROI
Definition: roi.h:58
firevision::ScanlineLineGrid::get_margin
unsigned int get_margin()
Get margin around points.
Definition: line_grid.cpp:185
firevision::ScanlineLineGrid::operator++
fawkes::upoint_t * operator++()
Postfix ++ operator.
Definition: line_grid.cpp:149
firevision::ScanlineLineGrid::set_dimensions
virtual void set_dimensions(unsigned int width, unsigned int height, ROI *roi=NULL)
Sets the dimensions of the grid.
Definition: line_grid.cpp:212
firevision::ScanlineLineGrid::operator*
fawkes::upoint_t operator*()
Get the current coordinate.
Definition: line_grid.cpp:75
firevision::ScanlineLineGrid::get_name
const char * get_name()
Get name of scanline model.
Definition: line_grid.cpp:179
firevision::ScanlineLineGrid::set_robot_pose
virtual void set_robot_pose(float x, float y, float ori)
Set the robot's pose.
Definition: line_grid.cpp:191
firevision::ScanlineLineGrid::finished
bool finished()
Check if all desired points have been processed.
Definition: line_grid.cpp:167
firevision::ScanlineLineGrid::operator->
fawkes::upoint_t * operator->()
Get pointer to current point.
Definition: line_grid.cpp:80