projective_cam.h

00001
00002 /***************************************************************************
00003  *  projective_cam.h - Abstract class defining a projective camera model
00004  *
00005  *  Generated: Thu May 8 15:08 2008
00006  *  Copyright  2008  Christof Rath <c.rath@student.tugraz.at>
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
00025 #ifndef __FIREVISION_PROJECTIVE_CAM_H__
00026 #define __FIREVISION_PROJECTIVE_CAM_H__
00027 
00028 #include <geometry/hom_transform.h>
00029 #include <fvutils/base/types.h>
00030 #include "calibration.h"
00031
00032 #include <core/exception.h>
00033
00034 class AboveHorizonException : public fawkes::Exception {
00035   public:
00036     AboveHorizonException(const char *msg, const center_in_roi_t img_pt) throw();
00037
00038     const center_in_roi_t& get_img_pt() const;
00039
00040   private:
00041     center_in_roi_t __img_pt;
00042 };
00043
00044 class ProjectiveCam
00045 {
00046   public:
00047     ProjectiveCam(const ProjectiveCam& pc);
00048     virtual ~ProjectiveCam();
00049
00050     //virtual HomTransform get_inverse() const;
00051
00052     virtual ProjectiveCam& set_location(const fawkes::HomTransform& loc);
00053     virtual ProjectiveCam& set_location(float roll, float pitch, float yaw, float height, float x = 0, float y = 0);
00054
00055     virtual fawkes::cart_coord_2d_t get_GPA_world_coord(const center_in_roi_t &img_p) const;
00056     virtual center_in_roi_t         get_GPA_image_coord(const fawkes::cart_coord_2d_t &wld_p) const;
00057
00058     virtual void print_info (const char* name = 0, const char *col_sep = 0, const char *row_sep = 0) const;
00059
00060   protected:
00061     ProjectiveCam(const Calibration &cal, const fawkes::HomTransform *loc = 0);
00062     ProjectiveCam(const Calibration &cal, float roll, float pitch, float yaw, float height, float x = 0, float y = 0);
00063     Calibration get_cal() const;
00064
00065     fawkes::Matrix get_p() const;
00066     fawkes::Matrix get_GPA_p() const;
00067
00068   private:
00069     Calibration    __cal;
00070     fawkes::Matrix *__p;
00071     fawkes::Matrix *__gpa_inv;
00072     float          *__gpa_inv_data;
00073 };
00074
00075 #endif // __FIREVISION_PROJECTIVE_CAM_H__