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 <models/mirror/bulb/bulb_generator.h>
00030 class Bulb;
00031 class BulbSampler;
00032
00033 class MirrorCalibTool : public BulbGeneratorProgressHandler
00034 #else
00035 class MirrorCalibTool
00036 #endif
00037 {
00038  public:
00039   MirrorCalibTool();
00040   MirrorCalibTool(unsigned int img_width, unsigned int img_height
00041                   /*, unsigned int num_dists, unsigned int num_oris*/);
00042   ~MirrorCalibTool();
00043
00044   void start();
00045   void abort();
00046   void step(unsigned int x, unsigned int y);
00047   bool get_next(float* dist, float* ori);
00048
00049   void eval(unsigned int x, unsigned int y, float* x_ret, float* y_ret);
00050
00051   void load(const char* filename);
00052   void save(const char* filename);
00053
00054   void set_img_dimensions(unsigned int width, unsigned int height);
00055
00056   void set_dists(float dists[], unsigned int num_dists);
00057   void set_oris(float oris[], unsigned int num_oris);
00058
00059   void setTotalSteps(unsigned int total_steps);
00060   void setProgress(unsigned int progress);
00061   void finished();
00062
00063  private:
00064   unsigned int m_img_width;
00065   unsigned int m_img_height;
00066
00067   unsigned int m_center_x;
00068   unsigned int m_center_y;
00069
00070   unsigned int m_next_x;
00071   unsigned int m_next_y;
00072   unsigned int m_next_ori;
00073
00074   static float m_sample_dist[];
00075   static float m_sample_ori[];
00076
00077   unsigned int m_sample_step;
00078   unsigned int m_sample_dist_step;
00079   unsigned int m_sample_ori_step;
00080   unsigned int m_num_dists;
00081   unsigned int m_num_oris;
00082
00083   fawkes::HomPoint m_next_sample_point;
00084
00085   bool m_calib_done;
00086   bool m_step_two;
00087
00088 #ifdef HAVE_BULB_CREATOR
00089   Bulb* m_bulb;
00090   BulbSampler* m_sampler;
00091   BulbGenerator* m_generator;
00092 #endif
00093 };
00094
00095
00096 #endif /*  __FIREVISION_TOOLS_IMAGE_VIEWER_MIRROR_CALIB_H_ */