Go to the documentation of this file.00001
00002 #include "sdet_harris_detector_params.h"
00003
00004
00005
00006
00007
00008 #include <vcl_sstream.h>
00009 #include <vcl_iostream.h>
00010
00011
00012
00013
00014
00015 sdet_harris_detector_params::
00016 sdet_harris_detector_params(const sdet_harris_detector_params& hdp)
00017 : gevd_param_mixin()
00018 {
00019 InitParams(hdp.sigma_,
00020 hdp.thresh_,
00021 hdp.n_,
00022 hdp.percent_corners_,
00023 hdp.scale_factor_,
00024 hdp.use_vil_harris_
00025 );
00026 }
00027
00028 sdet_harris_detector_params::
00029 sdet_harris_detector_params(const float sigma,
00030 const float thresh,
00031 const int n,
00032 const float percent_corners,
00033 const float scale_factor,
00034 const bool use_vil_harris
00035 )
00036 {
00037 InitParams(sigma, thresh, n, percent_corners, scale_factor,use_vil_harris);
00038 }
00039
00040 void sdet_harris_detector_params::InitParams(float sigma,
00041 float thresh,
00042 int n,
00043 float percent_corners,
00044 float scale_factor,
00045 bool use_vil_harris
00046 )
00047 {
00048 sigma_= sigma;
00049 thresh_ = thresh;
00050 n_ = n;
00051 percent_corners_ = percent_corners;
00052 scale_factor_=scale_factor;
00053 use_vil_harris_ = use_vil_harris;
00054 }
00055
00056
00057
00058
00059
00060
00061
00062 bool sdet_harris_detector_params::SanityCheck()
00063 {
00064 vcl_stringstream msg;
00065 bool valid = true;
00066
00067 if (sigma_<0.5)
00068 {
00069 msg << "ERROR: smoothing should be effective, >0.5";
00070 valid = false;
00071 }
00072 if (thresh_<0)
00073 {
00074 msg << "ERROR: invalid to have a negative threshold";
00075 valid = false;
00076 }
00077 if (n_<1||n_>5)
00078 {
00079 msg << "ERROR: should have a reasonable size for the neighborhood";
00080 valid = false;
00081 }
00082 if (percent_corners_<=0||percent_corners_>100)
00083 {
00084 msg << "ERROR: value must be a valid percentage";
00085 valid = false;
00086 }
00087 if (scale_factor_<0.01||scale_factor_>0.5)
00088 {
00089 msg << "ERROR: scale factor out of range";
00090 valid = false;
00091 }
00092 msg << vcl_ends;
00093
00094 SetErrorMsg(msg.str().c_str());
00095 return valid;
00096 }
00097
00098 vcl_ostream& operator<< (vcl_ostream& os, const sdet_harris_detector_params& hdp)
00099 {
00100 return
00101 os << "sdet_harris_detector_params:\n[---\n"
00102 << "sigma " << hdp.sigma_ << vcl_endl
00103 << "thresh " << hdp.thresh_ << vcl_endl
00104 << "n " << hdp.n_ << vcl_endl
00105 << "max_no_corners(percent) " << hdp.percent_corners_ << vcl_endl
00106 << "scale_factor " << hdp.scale_factor_ << vcl_endl
00107 << "vil_harris?" << hdp.use_vil_harris_ << vcl_endl
00108 << "---]" << vcl_endl;
00109 }