back_projection.h

00001 /***************************************************************************
00002  *  back_projection.h - Projective camera back projection model
00003  *
00004  *  Created:  Mon Apr 20 21:59:00 2009
00005  *  Copyright 2009 Christof Rath <christof.rath@gmail.com>
00006  *
00007  ****************************************************************************/
00008 
00009 /*  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU Library General Public License for more details.
00018  *
00019  *  Read the full text in the LICENSE.GPL file in the doc directory.
00020  */
00021 
00022 #ifndef __FIREVISION_MODELS_RELATIVE_POSITION_BACK_PROJECTION_H_
00023 #define __FIREVISION_MODELS_RELATIVE_POSITION_BACK_PROJECTION_H_
00024 
00025 #include <models/relative_position/relativepositionmodel.h>
00026 
00027 #include <models/camera/projective_cam.h>
00028 #include <utils/math/types.h>
00029 
00030 namespace firevision {
00031 #if 0 /* just to make Emacs auto-indent happy */
00032 }
00033 #endif
00034 
00035 class BackProjectionPositionModel : public RelativePositionModel
00036 {
00037  public:
00038   BackProjectionPositionModel(ProjectiveCam &projective_cam,
00039                               float ball_circumference = 0.f);
00040 
00041   virtual const char *  get_name() const { return "BackProjectionPositionModel"; }
00042   virtual void          set_radius(float r);
00043   virtual void          set_center(float x, float y);
00044   virtual void          set_center(const center_in_roi_t& c) { set_center(c.x, c.y); }
00045 
00046   virtual void          set_pan_tilt(float pan = 0.0f, float tilt = 0.0f) { set_cam_rotation(pan, tilt, 0.f); }
00047   virtual void          get_pan_tilt(float *pan, float *tilt) const;
00048 
00049   virtual void          set_cam_rotation(float pan = 0.f, float tilt = 0.f, float roll = 0.f);
00050   virtual void          get_cam_rotation(float &pan, float &tilt, float &roll) const;
00051 
00052   virtual void          set_cam_translation(float height, float rel_x = 0.f, float rel_y = 0.f);
00053   virtual void          get_cam_translation(float &height, float &rel_x, float &rel_y) const;
00054 
00055   virtual float         get_distance() const { return __distance; }
00056   virtual float         get_x() const        { return __world_x; }
00057   virtual float         get_y() const        { return __world_y; }
00058   virtual float         get_bearing() const  { return __bearing; }
00059   virtual float         get_slope() const    { return __slope; }
00060 
00061   virtual void          calc();
00062   virtual void          calc_unfiltered()    { calc(); }
00063   virtual void          reset();
00064 
00065   virtual bool          is_pos_valid() const { return __pos_valid; }
00066 
00067  private:
00068   ProjectiveCam&  __projective_cam;
00069 
00070   center_in_roi_t       __cirt_center;
00071 
00072   fawkes::point_6D_t    __cam_position;
00073 
00074   float                 __ball_circumference;
00075   float                 __ball_radius;
00076   float                 __world_x;
00077   float                 __world_y;
00078   float                 __bearing;
00079   float                 __slope;
00080   float                 __distance;
00081   bool                  __pos_valid;
00082 };
00083 
00084 } // end namespace firevision
00085 
00086 #endif /* BACK_PROJECTION_H_ */

Generated on Tue Feb 22 13:32:16 2011 for Fawkes API by  doxygen 1.4.7