Go to the documentation of this file.00001 #ifndef mfpf_point_finder_builder_h_
00002 #define mfpf_point_finder_builder_h_
00003 
00004 
00005 
00006 
00007 
00008 #include <vimt/vimt_image_2d_of.h>
00009 #include <vgl/vgl_fwd.h>
00010 
00011 #include <vsl/vsl_binary_io.h>
00012 #include <vcl_string.h>
00013 #include <vcl_memory.h>
00014 #include <vcl_iosfwd.h>
00015 
00016 class mfpf_point_finder;
00017 class mbl_read_props_type;
00018 
00019 
00020 class mfpf_point_finder_builder
00021 {
00022  protected:
00023   
00024   double step_size_;
00025 
00026   
00027   int search_ni_;
00028 
00029   
00030   int search_nj_;
00031 
00032   
00033   unsigned search_nA_;
00034 
00035   
00036   double search_dA_;
00037 
00038   
00039   unsigned search_ns_;
00040 
00041   
00042   double search_ds_;
00043 
00044   
00045   bool base_equality(const mfpf_point_finder_builder& b) const;
00046 
00047   
00048   void parse_base_props(mbl_read_props_type& props);
00049 
00050   
00051   void set_base_parameters(mfpf_point_finder& pf);
00052 
00053  public:
00054 
00055   
00056   mfpf_point_finder_builder();
00057 
00058   
00059   virtual ~mfpf_point_finder_builder();
00060 
00061   
00062   virtual void set_step_size(double);
00063 
00064   
00065   double step_size() const { return step_size_; }
00066 
00067   
00068   
00069   
00070   virtual void set_region_size(double wi, double wj) = 0;
00071 
00072   
00073   
00074   
00075   virtual void set_search_area(unsigned ni, unsigned nj);
00076 
00077   
00078   void set_search_angle_range(unsigned nA, double dA);
00079 
00080   
00081   void set_search_scale_range(unsigned ns, double ds);
00082 
00083   int search_ni() const { return search_ni_; }
00084   int search_nj() const { return search_nj_; }
00085 
00086   
00087   unsigned search_nA() const { return search_nA_; }
00088 
00089   
00090   double search_dA() const { return search_dA_; }
00091 
00092   
00093   unsigned search_ns() const { return search_ns_; }
00094 
00095   
00096   double search_ds() const { return search_ds_; }
00097 
00098   
00099   virtual unsigned model_dim();
00100 
00101   
00102   virtual mfpf_point_finder* new_finder() const =0;
00103 
00104   
00105   
00106   virtual void clear(unsigned n_egs)=0;
00107 
00108   
00109   virtual void get_sample_vector(const vimt_image_2d_of<float>& image,
00110                                  const vgl_point_2d<double>& p,
00111                                  const vgl_vector_2d<double>& u,
00112                                  vcl_vector<double>& v);
00113 
00114   
00115   virtual void add_example(const vimt_image_2d_of<float>& image,
00116                            const vgl_point_2d<double>& p,
00117                            const vgl_vector_2d<double>& u)=0;
00118 
00119   
00120   virtual void build(mfpf_point_finder&)=0;
00121 
00122   
00123   virtual bool set_from_stream(vcl_istream &is);
00124 
00125   
00126   short version_no() const;
00127 
00128   
00129   virtual vcl_string is_a() const;
00130 
00131   
00132   virtual mfpf_point_finder_builder* clone() const = 0;
00133 
00134   
00135   virtual void print_summary(vcl_ostream& os) const ;
00136 
00137   
00138   virtual void b_write(vsl_b_ostream& bfs) const;
00139 
00140   
00141   virtual void b_read(vsl_b_istream& bfs);
00142 
00143   
00144   static vcl_auto_ptr<mfpf_point_finder_builder> create_from_stream(vcl_istream &is);
00145 };
00146 
00147 
00148 void vsl_add_to_binary_loader(const mfpf_point_finder_builder& b);
00149 
00150 
00151 void vsl_b_write(vsl_b_ostream& bfs, const mfpf_point_finder_builder& b);
00152 
00153 
00154 void vsl_b_read(vsl_b_istream& bfs, mfpf_point_finder_builder& b);
00155 
00156 
00157 vcl_ostream& operator<<(vcl_ostream& os,const mfpf_point_finder_builder& b);
00158 
00159 
00160 vcl_ostream& operator<<(vcl_ostream& os,const mfpf_point_finder_builder* b);
00161 
00162 #endif // mfpf_point_finder_builder_h_