Go to the documentation of this file.00001 #ifndef mfpf_region_finder_builder_h_
00002 #define mfpf_region_finder_builder_h_
00003
00004
00005
00006
00007
00008 #include <mfpf/mfpf_point_finder_builder.h>
00009 #include <mfpf/mfpf_vec_cost_builder.h>
00010 #include <mbl/mbl_cloneable_ptr.h>
00011 #include <mbl/mbl_chord.h>
00012 #include <vcl_iosfwd.h>
00013 #include <mfpf/mfpf_region_form.h>
00014 #include <vgl/vgl_fwd.h>
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class mfpf_region_finder_builder : public mfpf_point_finder_builder
00028 {
00029 private:
00030
00031 double ref_x_;
00032
00033 double ref_y_;
00034
00035
00036 vcl_string shape_;
00037
00038
00039 vcl_vector<mbl_chord> roi_;
00040
00041
00042 unsigned roi_ni_;
00043
00044 unsigned roi_nj_;
00045
00046
00047 unsigned n_pixels_;
00048
00049
00050 mbl_cloneable_ptr<mfpf_vec_cost_builder> cost_builder_;
00051
00052
00053 short norm_method_;
00054
00055
00056 unsigned nA_;
00057
00058
00059 double dA_;
00060
00061
00062
00063 double overlap_f_;
00064
00065
00066 double var_min_;
00067
00068
00069 double tvar_min_;
00070
00071
00072 bool estimate_var_min_;
00073
00074
00075 unsigned num_examples_;
00076
00077
00078 void set_defaults();
00079
00080
00081 void set_as_box(unsigned ni, unsigned nj,
00082 double ref_x, double ref_y);
00083
00084
00085
00086 void set_as_ellipse(double ri, double rj);
00087
00088
00089
00090 void config_as_box(vcl_istream &is);
00091
00092
00093
00094 void config_as_ellipse(vcl_istream &is);
00095
00096
00097 void add_one_example(const vimt_image_2d_of<float>& image,
00098 const vgl_point_2d<double>& p,
00099 const vgl_vector_2d<double>& u);
00100
00101 public:
00102
00103
00104 mfpf_region_finder_builder();
00105
00106
00107 virtual ~mfpf_region_finder_builder();
00108
00109
00110 void set_as_box(unsigned ni, unsigned nj,
00111 double ref_x, double ref_y,
00112 const mfpf_vec_cost_builder& builder);
00113
00114
00115
00116 void set_as_box(unsigned ni, unsigned nj,
00117 const mfpf_vec_cost_builder& builder);
00118
00119
00120
00121 void set_as_ellipse(double ri, double rj,
00122 const mfpf_vec_cost_builder& builder);
00123
00124
00125
00126
00127 void set_region(const mfpf_region_form& form);
00128
00129
00130
00131
00132
00133 virtual void set_region_size(double wi, double wj);
00134
00135
00136
00137 unsigned n_pixels() const { return n_pixels_; }
00138
00139
00140 const vcl_string& shape() const { return shape_; }
00141
00142
00143 mfpf_vec_cost_builder& cost_builder() { return cost_builder_; }
00144
00145
00146 virtual unsigned model_dim();
00147
00148
00149 virtual mfpf_point_finder* new_finder() const;
00150
00151
00152
00153 virtual void clear(unsigned n_egs);
00154
00155
00156 virtual void add_example(const vimt_image_2d_of<float>& image,
00157 const vgl_point_2d<double>& p,
00158 const vgl_vector_2d<double>& u);
00159
00160
00161 virtual void build(mfpf_point_finder&);
00162
00163
00164 virtual bool set_from_stream(vcl_istream &is);
00165
00166
00167 virtual vcl_string is_a() const;
00168
00169
00170 virtual mfpf_point_finder_builder* clone() const;
00171
00172
00173 virtual void print_summary(vcl_ostream& os) const;
00174
00175
00176 void print_shape(vcl_ostream& os) const;
00177
00178
00179 short version_no() const;
00180
00181
00182 virtual void b_write(vsl_b_ostream& bfs) const;
00183
00184
00185 virtual void b_read(vsl_b_istream& bfs);
00186 };
00187
00188 #endif