1 #ifndef gevd_detector_params_h_ 2 #define gevd_detector_params_h_ 3 //: 4 // \file 5 // \brief non-display-based interface class 6 // 7 // The parameter mixin for VanDuc's edge detector. 8 // 9 // - float smooth : The standard deviation of the Gaussian smoothing kernel. 10 // 11 // - float noise_weight: A weighting factor that determines the relative 12 // proportion of sensor noise level and texture noise level 13 // as measured in a ROI in the center of the image. The 14 // nominal value of 0.5 gives equal weight to both. 15 // 16 // - float noise_multiplier: Overall scale factor for noise 17 // 18 // - bool automatic_threshold: If true then the noise level is determined from 19 // image measurements. 20 // 21 // - float filterFactor: An overall scale factor for determining 22 // gradient threshold Nominally 2.0. 23 // 24 // - float contourFactor, junctionFactor: Scale factors for determining the 25 // gradient threshold. Nominally 1.0. 26 // contourFactor is in effect for edgels 27 // on contours (boundaries). 28 // junctionFactor is in effect during the 29 // extension of contours at endpoints. 30 // To extend contours aggressively, use a 31 // low value of junctionFactor, i.e., .5. 32 // 33 // - bool junctionp: If true, then recover junctions by extending contours. 34 // Nominally true. 35 // 36 // - Contour Following: 37 // - float hysteresisFactor: A scale factor which is multiplied by the 38 // image noise level to determine the minimum 39 // gradient threshold in following an edgel contour. 40 // Nominally 2.0. 41 // 42 // - int minLength: The minimum length contour to constructed. 43 // 44 // - float minJump: A scale factor which is multiplied by the 45 // image noise level to determine the gradient 46 // threshold at a junction. Nominally 1.0. 47 // 48 // - float maxGap: The width of a gap which can be crossed in 49 // forming a junction with another edgel contour. 50 // Nominally sqrt(5) = 2.24. 51 // 52 // - bool spacingp: If true, then equalize the sub-pixel locations 53 // of each edgel by averaging the adjacent left 54 // a right neighbor locations. Nominally true. 55 // 56 // - bool borderp: If true, insert virtual contours at the border 57 // to close regions. Nominally false. 58 // 59 // 60 // \author Joseph L. Mundy - GE Corporate Research and Development 61 // \date November 1997 62 //----------------------------------------------------------------------------- 63 64 #include "gevd_param_mixin.h" 65 66 class gevd_detector_params : public gevd_param_mixin 67 { 68 public: 69 70 gevd_detector_params(float smooth_sigma = 1.0f, float noise_w = -0.5f, 71 float noise_m = 2.0f, bool automatic_t = false, 72 int aggressive_jc = 1, int minl = 4, 73 float maxgp = 4.0f, float minjmp = 0.1f, 74 float contour_f = 2.0f, float junction_f = 1.0f, 75 bool recover_j = true, bool equal_spacing=true, 76 bool follow_b = true, 77 bool peaks_only=false, 78 bool valleys_only=false, 79 float ang = 10.0f, float sep = 1.0f, int min_corner_len = 5, 80 int cyc = 2, int ndim = 2); 81 82 gevd_detector_params(const gevd_detector_params& old_params); 83 ~gevd_detector_params() override = default; 84 85 bool SanityCheck() override; 86 #if 0//not implemented in vxl 87 void Describe(ParamModifier& mod); 88 #endif 89 void set_noise_weight(float noise_weight); 90 void set_noise_multiplier(float noise_multiplier); 91 void set_automatic_threshold(bool automatic_threshold); 92 void set_aggressive_junction_closure(int aggressive_junction_closure); 93 void set_close_borders(bool close_borders); 94 95 protected: 96 void InitParams(float smooth_sigma, float noise_w, 97 float noise_m, bool automatic_t, 98 int aggressive_jc, int minl, 99 float maxgp, float minjmp, 100 float contour_f, float junction_f, 101 bool recover_j, bool equal_spacing, 102 bool follow_b, 103 bool peaks_only, 104 bool valleys_only, 105 float ang, float sep, int min_corner_len, 106 int cyc, int ndim); 107 108 public: 109 // 110 // Parameters for detecting edgel chains 111 // 112 float smooth; // !< Smoothing kernel sigma 113 float noise_weight; //!< The weight between sensor noise and texture noise 114 float noise_multiplier; // !< The overal noise threshold scale factor 115 bool automatic_threshold; // !< Determine the threshold values from image 116 int aggressive_junction_closure; //!< Close junctions aggressively 117 int minLength; // !< minimum chain length 118 float contourFactor; //!< Threshold along contours 119 float junctionFactor; //!< Threshold at junctions 120 float filterFactor; // !< ratio of sensor to texture noise 121 bool junctionp; // !< recover missing junctions 122 float minJump; // !< change in strength at junction 123 float maxGap; // !< Bridge small gaps up to max_gap across. 124 bool spacingp; // !< equalize spacing? 125 bool borderp; // !< insert virtual border for closure? 126 // 127 // Fold detection parameters 128 // 129 bool peaks_only; //!< Only return peaks, d^2I/dn^2 < 0, n is normal dir to ridge 130 bool valleys_only; //!< Only return valeys, d^2I/dn^2 > 0 131 // 132 // Parameters for corner detection on edgel chains 133 // 134 float corner_angle; // !< smallest angle at corner 135 float separation; // !< |mean1-mean2|/sigma 136 int min_corner_length; // !< min length to find corners 137 int cycle; // !< number of corners in a cycle 138 int ndimension; // !< spatial dimension of edgel chains. 139 }; 140 141 #endif // gevd_detector_params_h_ 142