Go to the documentation of this file.00001
00002 #include "vifa_int_face_attr_common_params.h"
00003
00004
00005
00006 #include <vcl_iostream.h>
00007 #include <vcl_sstream.h>
00008
00009
00010 vifa_int_face_attr_common_params::
00011 vifa_int_face_attr_common_params(vdgl_fit_lines_params* fitter_params,
00012 vifa_group_pgram_params* gpp_s,
00013 vifa_group_pgram_params* gpp_w,
00014 vifa_coll_lines_params* cpp,
00015 vifa_norm_params* np)
00016 {
00017 init_params(fitter_params,
00018 gpp_s,
00019 gpp_w,
00020 cpp,
00021 np);
00022 }
00023
00024 vifa_int_face_attr_common_params::
00025 vifa_int_face_attr_common_params(const vifa_int_face_attr_common_params& ifap)
00026 : gevd_param_mixin(), vul_timestamp(), vbl_ref_count()
00027 {
00028 init_params(ifap.fitter_params_.ptr(),
00029 ifap.gpp_s_.ptr(),
00030 ifap.gpp_w_.ptr(),
00031 ifap.cpp_.ptr(),
00032 ifap.np_.ptr());
00033 }
00034
00035 vifa_int_face_attr_common_params::
00036 ~vifa_int_face_attr_common_params()
00037 {
00038
00039 }
00040
00041
00042 void vifa_int_face_attr_common_params::
00043 set_params(const vifa_int_face_attr_common_params& ifap)
00044 {
00045 init_params(ifap.fitter_params_.ptr(),
00046 ifap.gpp_s_.ptr(),
00047 ifap.gpp_w_.ptr(),
00048 ifap.cpp_.ptr(),
00049 ifap.np_.ptr());
00050 }
00051
00052
00053 bool vifa_int_face_attr_common_params::SanityCheck()
00054 {
00055 vcl_stringstream msg;
00056 bool valid;
00057
00058 if (!fitter_params_.ptr() ||
00059 !gpp_s_.ptr() ||
00060 !gpp_w_.ptr() ||
00061 !cpp_.ptr())
00062 {
00063 msg << "ERROR: {FitLines, GroupParallelogram, CollinearLines} params not set." << vcl_ends;
00064 valid = false;
00065 }
00066 else
00067 {
00068
00069 valid = fitter_params_->SanityCheck() &&
00070 gpp_s_->SanityCheck() &&
00071 gpp_w_->SanityCheck() &&
00072 cpp_->SanityCheck();
00073 }
00074
00075 SetErrorMsg(msg.str().c_str());
00076 return valid;
00077 }
00078
00079 void vifa_int_face_attr_common_params::
00080 print_info(void)
00081 {
00082 vcl_cout << "vifa_int_face_attr_common_params:\n"
00083 << " line fitting params: ";
00084 if (fitter_params_.ptr())
00085 vcl_cout << *fitter_params_;
00086 else
00087 vcl_cout << "NULL\n";
00088 vcl_cout << " strong group parallellogram params: ";
00089 if (gpp_s_.ptr())
00090 gpp_s_->print_info();
00091 else
00092 vcl_cout << "NULL\n";
00093 vcl_cout << " weak group parallellogram params: ";
00094 if (gpp_w_.ptr())
00095 gpp_w_->print_info();
00096 else
00097 vcl_cout << "NULL\n";
00098 vcl_cout << " collinear lines params: ";
00099 if (cpp_.ptr())
00100 cpp_->print_info();
00101 else
00102 vcl_cout << "NULL\n";
00103 vcl_cout << " normalization params: ";
00104 if (np_.ptr())
00105 np_->print_info();
00106 else
00107 vcl_cout << "NULL\n";
00108 }
00109
00110
00111 void vifa_int_face_attr_common_params::
00112 init_params(vdgl_fit_lines_params* fitter_params,
00113 vifa_group_pgram_params* gpp_s,
00114 vifa_group_pgram_params* gpp_w,
00115 vifa_coll_lines_params* cpp,
00116 vifa_norm_params* np
00117 )
00118 {
00119 if (fitter_params)
00120 fitter_params_ = new vdgl_fit_lines_params(*fitter_params);
00121 else
00122 fitter_params_ = new vdgl_fit_lines_params( 6);
00123 if (gpp_s)
00124 gpp_s_ = new vifa_group_pgram_params(*gpp_s);
00125 else
00126 gpp_s_ = new vifa_group_pgram_params( 5.0f);
00127 if (gpp_w)
00128 gpp_w_ = new vifa_group_pgram_params(*gpp_w);
00129 else
00130 gpp_w_ = new vifa_group_pgram_params( 20.0f);
00131 if (cpp)
00132 cpp_ = new vifa_coll_lines_params(*cpp);
00133 else
00134 cpp_ = new vifa_coll_lines_params();
00135 if (np)
00136 np_ = new vifa_norm_params(*np);
00137 else
00138 np_ = new vifa_norm_params();
00139 }
00140
00141
00142
00143 void vifa_int_face_attr_common_params::
00144 init_params(const vdgl_fit_lines_params& fitter_params,
00145 const vifa_group_pgram_params& gpp_s,
00146 const vifa_group_pgram_params& gpp_w,
00147 const vifa_coll_lines_params& cpp,
00148 const vifa_norm_params& np
00149 )
00150 {
00151 fitter_params_ = new vdgl_fit_lines_params(fitter_params);
00152 gpp_s_ = new vifa_group_pgram_params(gpp_s);
00153 gpp_w_ = new vifa_group_pgram_params(gpp_w);
00154 cpp_ = new vifa_coll_lines_params(cpp);
00155 np_ = new vifa_norm_params(np);
00156 }