Fawkes API  Fawkes Development Version
back_projection.h
1 /***************************************************************************
2  * back_projection.h - Projective camera back projection model
3  *
4  * Created: Mon Apr 20 21:59:00 2009
5  * Copyright 2009 Christof Rath <christof.rath@gmail.com>
6  *
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __FIREVISION_MODELS_RELATIVE_POSITION_BACK_PROJECTION_H_
23 #define __FIREVISION_MODELS_RELATIVE_POSITION_BACK_PROJECTION_H_
24 
25 #include <fvmodels/relative_position/relativepositionmodel.h>
26 
27 #include <fvmodels/camera/projective_cam.h>
28 #include <utils/math/types.h>
29 
30 namespace firevision {
31 #if 0 /* just to make Emacs auto-indent happy */
32 }
33 #endif
34 
36 {
37  public:
39  float ball_circumference = 0.f);
40 
41  virtual const char * get_name() const { return "BackProjectionPositionModel"; }
42  virtual void set_radius(float r);
43  virtual void set_center(float x, float y);
44  virtual void set_center(const center_in_roi_t& c) { set_center(c.x, c.y); }
45 
46  virtual void set_pan_tilt(float pan = 0.0f, float tilt = 0.0f) { set_cam_rotation(pan, tilt, 0.f); }
47  virtual void get_pan_tilt(float *pan, float *tilt) const;
48 
49  virtual void set_cam_rotation(float pan = 0.f, float tilt = 0.f, float roll = 0.f);
50  virtual void get_cam_rotation(float &pan, float &tilt, float &roll) const;
51 
52  virtual void set_cam_translation(float height, float rel_x = 0.f, float rel_y = 0.f);
53  virtual void get_cam_translation(float &height, float &rel_x, float &rel_y) const;
54 
55  virtual float get_distance() const { return __distance; }
56  virtual float get_x() const { return __world_x; }
57  virtual float get_y() const { return __world_y; }
58  virtual float get_bearing() const { return __bearing; }
59  virtual float get_slope() const { return __slope; }
60 
61  virtual void calc();
62  virtual void calc_unfiltered() { calc(); }
63  virtual void reset();
64 
65  virtual bool is_pos_valid() const { return __pos_valid; }
66 
67  private:
68  ProjectiveCam& __projective_cam;
69 
70  center_in_roi_t __cirt_center;
71 
72  fawkes::point_6D_t __cam_position;
73 
74  float __ball_circumference;
75  float __ball_radius;
76  float __world_x;
77  float __world_y;
78  float __bearing;
79  float __slope;
80  float __distance;
81  bool __pos_valid;
82 };
83 
84 } // end namespace firevision
85 
86 #endif /* BACK_PROJECTION_H_ */
virtual void get_pan_tilt(float *pan, float *tilt) const
Get camera pan tilt.
virtual void set_center(const center_in_roi_t &c)
Set center of a found circle.
virtual void set_cam_rotation(float pan=0.f, float tilt=0.f, float roll=0.f)
Sets the camera orientation.
virtual bool is_pos_valid() const
Check if position is valid.
virtual void get_cam_translation(float &height, float &rel_x, float &rel_y) const
Returns the current translation of the camera.
virtual void calc_unfiltered()
Calculate data unfiltered.
virtual void get_cam_rotation(float &pan, float &tilt, float &roll) const
Returns the camera orientation.
virtual float get_y() const
Get relative Y coordinate of object.
virtual float get_slope() const
Get slope (vertical angle) to object.
float x
x in pixels
Definition: types.h:40
virtual float get_distance() const
Get distance to object.
Defines a point with 6-degrees of freedom.
Definition: types.h:133
virtual void reset()
Reset all data.
Abstract class for projective cameras.
Relative Position Model Interface.
BackProjectionPositionModel(ProjectiveCam &projective_cam, float ball_circumference=0.f)
Constructor.
virtual void set_pan_tilt(float pan=0.0f, float tilt=0.0f)
Set camera pan and tilt.
virtual float get_x() const
Get relative X coordinate of object.
virtual void calc()
Calculate position data.
virtual void set_radius(float r)
Set radius of a found circle.
virtual void set_center(float x, float y)
Set center of a found circle.
virtual void set_cam_translation(float height, float rel_x=0.f, float rel_y=0.f)
Sets the current translation of the camera.
This model uses a ProjectiveCam to back project points in the image to the world by the ground plane ...
virtual float get_bearing() const
Get bearing (horizontal angle) to object.
Center in ROI.
Definition: types.h:39
float y
y in pixels
Definition: types.h:41
virtual const char * get_name() const
Get name of relative position model.