mirror_calib.h

00001 
00002 /***************************************************************************
00003  *  mirror_calib.h - Mirror calibration tool
00004  *
00005  *  Created: Fri Dec 07 18:34:50 2007
00006  *  Copyright  2007  Daniel Beck
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.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __FIREVISION_TOOLS_FIRESTATION_MIRROR_CALIB_H_
00024 #define __FIREVISION_TOOLS_FIRESTATION_MIRROR_CALIB_H_
00025 
00026 #include <geometry/hom_point.h>
00027 
00028 #ifdef HAVE_BULB_CREATOR
00029 #include <bulb_calib/bulb_generator.h>
00030 namespace firevision {
00031   class Bulb;
00032   class BulbSampler;
00033 }
00034 
00035 class MirrorCalibTool : public firevision::BulbGeneratorProgressHandler
00036 #else
00037 class MirrorCalibTool
00038 #endif
00039 {
00040  public:
00041   MirrorCalibTool();
00042   MirrorCalibTool(unsigned int img_width, unsigned int img_height
00043                   /*, unsigned int num_dists, unsigned int num_oris*/);
00044   ~MirrorCalibTool();
00045 
00046   void start();
00047   void abort();
00048   void step(unsigned int x, unsigned int y);
00049   bool get_next(float* dist, float* ori);
00050   
00051   void eval(unsigned int x, unsigned int y, float* x_ret, float* y_ret);
00052 
00053   void load(const char* filename);
00054   void save(const char* filename);
00055 
00056   void set_img_dimensions(unsigned int width, unsigned int height);
00057 
00058   void set_dists(float dists[], unsigned int num_dists);
00059   void set_oris(float oris[], unsigned int num_oris);
00060 
00061   void setTotalSteps(unsigned int total_steps);
00062   void setProgress(unsigned int progress);
00063   void finished();
00064   
00065  private:
00066   unsigned int m_img_width;
00067   unsigned int m_img_height;
00068 
00069   unsigned int m_center_x;
00070   unsigned int m_center_y;
00071 
00072   unsigned int m_next_x;
00073   unsigned int m_next_y;
00074   unsigned int m_next_ori;
00075 
00076   static float m_sample_dist[];
00077   static float m_sample_ori[];
00078 
00079   unsigned int m_sample_step;
00080   unsigned int m_sample_dist_step;
00081   unsigned int m_sample_ori_step;
00082   unsigned int m_num_dists;
00083   unsigned int m_num_oris;
00084 
00085   fawkes::HomPoint m_next_sample_point;
00086 
00087   bool m_calib_done;
00088   bool m_step_two;
00089 
00090 #ifdef HAVE_BULB_CREATOR
00091   firevision::Bulb* m_bulb;
00092   firevision::BulbSampler* m_sampler;
00093   firevision::BulbGenerator* m_generator;
00094 #endif
00095 };
00096 
00097 
00098 #endif /*  __FIREVISION_TOOLS_IMAGE_VIEWER_MIRROR_CALIB_H_ */