contrib/brl/bseg/sdet/sdet_detector_params.h
Go to the documentation of this file.
00001 // <begin copyright notice>
00002 // ---------------------------------------------------------------------------
00003 //
00004 //                   Copyright (c) 1997 TargetJr Consortium
00005 //               GE Corporate Research and Development (GE CRD)
00006 //                             1 Research Circle
00007 //                            Niskayuna, NY 12309
00008 //                            All Rights Reserved
00009 //              Reproduction rights limited as described below.
00010 //
00011 //      Permission to use, copy, modify, distribute, and sell this software
00012 //      and its documentation for any purpose is hereby granted without fee,
00013 //      provided that (i) the above copyright notice and this permission
00014 //      notice appear in all copies of the software and related documentation,
00015 //      (ii) the name TargetJr Consortium (represented by GE CRD), may not be
00016 //      used in any advertising or publicity relating to the software without
00017 //      the specific, prior written permission of GE CRD, and (iii) any
00018 //      modifications are clearly marked and summarized in a change history
00019 //      log.
00020 //
00021 //      THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
00022 //      EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
00023 //      WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00024 //      IN NO EVENT SHALL THE TARGETJR CONSORTIUM BE LIABLE FOR ANY SPECIAL,
00025 //      INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND OR ANY
00026 //      DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
00027 //      WHETHER OR NOT ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR ON
00028 //      ANY THEORY OF LIABILITY ARISING OUT OF OR IN CONNECTION WITH THE
00029 //      USE OR PERFORMANCE OF THIS SOFTWARE.
00030 //
00031 // ---------------------------------------------------------------------------
00032 // <end copyright notice>
00033 #ifndef sdet_detector_params_h_
00034 #define sdet_detector_params_h_
00035 //
00036 // \brief non-display-based interface class
00037 //
00038 // The parameter mixin for VanDuc's edge detector.
00039 //
00040 // - float smooth : The standard deviation of the Gaussian smoothing kernel.
00041 //
00042 // - float noise_weight: A weighting factor that determines the relative
00043 //                       proportion of sensor noise level and texture noise level
00044 //                       as measured in a ROI in the center of the image. The
00045 //                       nominal value of 0.5 gives equal weight to both.
00046 //
00047 // - float noise_multiplier: Overall scale factor for noise
00048 //
00049 // - bool automatic_threshold: If true then the noise level is determined from
00050 //                            image measurements.
00051 //
00052 // - float filterFactor:  An overall scale factor for determining
00053 //                        gradient threshold Nominally 2.0.
00054 //
00055 // - float contourFactor, junctionFactor: Scale factors for determining the
00056 //                                        gradient threshold. Nominally 1.0.
00057 //                                        contourFactor is in effect for edgels
00058 //                                        on contours (boundaries).
00059 //                                        junctionFactor is in effect during the
00060 //                                        extension of contours at endpoints.
00061 //                                        To extend contours aggressively, use a
00062 //                                        low value of junctionFactor, i.e., .5.
00063 //
00064 // - bool  junctionp:  If true, then recover junctions by extending contours.
00065 //                    Nominally true.
00066 //
00067 // - Contour Following:
00068 //
00069 // - float hysteresisFactor:    A scale factor which is multiplied by the
00070 //                              image noise level to determine the minimum
00071 //                              gradient threshold in following an edgel contour.
00072 //                              Nominally 2.0.
00073 //
00074 // - int minLength:             The minimum length contour to constructed.
00075 //
00076 // - float minJump:             A scale factor which is multiplied by the
00077 //                              image noise level to determine the gradient
00078 //                              threshold at a junction. Nominally 1.0.
00079 //
00080 // - float maxGap:              The width of a gap which can be crossed in
00081 //                              forming a junction with another edgel contour.
00082 //                              Nominally sqrt(5) = 2.24.
00083 //
00084 // - bool spacingp:             If true, then equalize the sub-pixel locations
00085 //                              of each edgel by averaging the adjacent left
00086 //                              a right neighbor locations. Nominally true.
00087 //
00088 // - bool borderp:              If true, insert virtual contours at the border
00089 //                              to close regions. Nominally false.
00090 //
00091 // \author
00092 //             Joseph L. Mundy - November 1997
00093 //             GE Corporate Research and Development
00094 
00095 //-----------------------------------------------------------------------------
00096 #include <vcl_iosfwd.h>
00097 #include <gevd/gevd_param_mixin.h>
00098 
00099 class sdet_detector_params : public gevd_param_mixin
00100 {
00101  public:
00102   sdet_detector_params(float smooth_sigma = 1.0f, float noise_w = -0.5f,
00103                        float noise_m = 1.5f, bool automatic_t = false,
00104                        int aggressive_jc = 1, int minl = 6,
00105                        float maxgp = 4.0f, float minjmp = 0.1f,
00106                        float contour_f = 2.0f, float junction_f = 1.0f,
00107                        bool recover_j = true, bool equal_spacing=false,
00108                        bool follow_b = true,
00109                        bool peaks_only=false,
00110                        bool valleys_only=false,
00111                        float ang = 10.0f, float sep = 1.f, int min_corner_len = 5,
00112                        int cyc = 2, int ndim = 2);
00113 
00114   sdet_detector_params(const sdet_detector_params& old_params);
00115   ~sdet_detector_params() {}
00116   friend vcl_ostream& operator<<(vcl_ostream&, const sdet_detector_params& dp);
00117   bool SanityCheck();
00118 #if 0
00119   void Describe(ParamModifier& mod);
00120 #endif
00121   void set_noise_weight(float noise_weight);
00122   void set_noise_multiplier(float noise_multiplier);
00123   void set_automatic_threshold(bool automatic_threshold);
00124   void set_aggressive_junction_closure(int aggressive_junction_closure);
00125   void set_close_borders(bool close_borders);
00126 
00127  protected:
00128   void InitParams(float smooth_sigma, float noise_w,
00129                   float noise_m, bool automatic_t,
00130                   int aggressive_jc, int minl,
00131                   float maxgp, float minjmp,
00132                   float contour_f, float junction_f,
00133                   bool recover_j, bool equal_spacing,
00134                   bool follow_b,
00135                   bool peaks_only,
00136                   bool valleys_only,
00137                   float ang, float sep, int min_corner_len,
00138                   int cyc, int ndim);
00139 
00140  public:
00141   //
00142   // Parameters for detecting edgel chains
00143   //
00144   float smooth; //!< Smoothing kernel sigma
00145   float noise_weight; //!<The weight between sensor noise and texture noise
00146   float noise_multiplier; //!< The overal noise threshold scale factor
00147   bool   automatic_threshold; //!< Determine the threshold values from image
00148   int aggressive_junction_closure; //!<Close junctions aggressively
00149   int minLength;                //!< minimum chain length
00150   float contourFactor;  //!<Threshold along contours
00151   float junctionFactor; //!<Threshold at junctions
00152   float filterFactor;   //!< ratio of sensor to texture noise
00153   bool junctionp; //!< recover missing junctions
00154   float minJump;  //!< change in strength at junction
00155   float maxGap;   //!< Bridge small gaps up to max_gap across.
00156   bool spacingp;  //!< equalize spacing?
00157   bool borderp;   //!< insert virtual border for closure?
00158   //
00159   // Fold detection parameters
00160   //
00161   bool peaks_only; //!<Only return peaks, d^2I/dn^2 < 0, n is normal dir to ridge
00162   bool valleys_only; //!<Only return valeys, d^2I/dn^2 > 0
00163   //
00164   // Parameters for corner detection on edgel chains
00165   //
00166   float corner_angle; //!< smallest angle at corner
00167   float separation; //!< |mean1-mean2|/sigma
00168   int min_corner_length; //!< min length to find corners
00169   int cycle; //!< number of corners in a cycle
00170   int ndimension; //!< spatial dimension of edgel chains.
00171 };
00172 
00173 #endif