1 // This is brl/bseg/sdet/sdet_symbolic_edge_linker_params.h
2 #ifndef sdet_symbolic_edge_linker_params_h_
3 #define sdet_symbolic_edge_linker_params_h_
4 //:
5 // \file
6 // \brief parameter mixin for symbolic edge linker
7 //
8 //-----------------------------------------------------------------------------
9 #include <iostream>
10 #include <iosfwd>
11 #include <gevd/gevd_param_mixin.h>
12 #ifdef _MSC_VER
13 #  include <vcl_msvc_warnings.h>
14 #endif
15 
16 
17 class sdet_symbolic_edge_linker_params : public gevd_param_mixin
18 {
19   public:
20 // enumeration for the curve model choices
21   enum {SIMPLE_LINEAR, LINEAR, CIRC_ARC_WO_PERT, CIRC_ARC_W_CLASSES, CIRC_ARC_W_PERT,
22         CIRC_ARC_3D_BUNDLE, ES_WO_PERT, ES_W_PERT};
23 // enumeration for algorithm choices
24   enum {GREEDY_GROUP, VERY_GREEDY_GROUP};
25 // enumeration for curvelet choices
26   enum {ANCHOR_CENT, ANCHOR_CENT_BI, ANCHOR_LEAD_BI, ENO_STYLE};
27 // enumeration for appearance choices
28   enum {DO_NOT_USE, LOCAL_COMP, AGAINST_REF};
29 // enumeration for link graph choices
30   enum {ALL, IMMEDIATE_ONLY, IMMEDIATE_RECIP, IMMEDIATE_RECIP_W_SUPPORT, TRIPLETS_W_SUPPORT};
31 // enumeration for link algo choices
32   enum { DO_NOT_LINK, FROM_LINK_GRAPH, REGULAR_CONTOURS };
33 
34   /*
35    * Parameters
36    *
37    *                  nrad - Radius of neighborhood
38    *                   gap - Maximum pixel distance to complete
39    *            adap_uncer - Get uncertanty from edges
40    *                    dx - Position uncertanty
41    *                    dt - Orientation uncertanty (deg)
42    *           cvlet_model - Curve Model
43    *             token_len - Token length
44    *                 max_k - Maximum curvature
45    *             max_gamma - Maximum curvature derivative
46    *         grouping_algo - Local grouping algorithm
47    *            cvlet_type - Curvelet type
48    *             app_usage - Appearance usage
49    *            app_thresh - Appearance threshold
50    *     max_size_to_group - Maximum number of edgels to group
51    *  formCompleteCvletMap - Form complete curvelet map
52    *         formLinkGraph - Form link graph
53    *         use_all_cvlet - Use all curvelets
54    *        linkgraph_algo - Extract image contours
55    *        num_link_iters - Number of linking iterations
56    *    get_final_contours - Get final contours
57    */
58 
59   sdet_symbolic_edge_linker_params(double nrad = 3.5, double gap = 2.0, bool adap_uncer = true,
60                                    double dx = 0.4, double dt = 15.0, unsigned curve_model = 5,
61                                    double token_len = 1.0, double max_k = 0.2, double max_gamma = 0.05,
62                                    unsigned grouping_algo = 0, unsigned cvlet_type = 0,
63                                    unsigned app_usage = 0, double app_thresh = 0.2, unsigned max_size_to_group = 7,
64                                    bool formCompleteCvletMap = false, bool formLinkGraph = true,
65                                    bool use_all_cvlet = false, unsigned linkgraph_algo = 0,
66                                    unsigned min_size_to_link = 4, unsigned linking_algo = 0,
67                                    unsigned num_link_iters = 7, bool get_final_contours = true);
68 
69   sdet_symbolic_edge_linker_params(const sdet_symbolic_edge_linker_params& old_params);
70   ~sdet_symbolic_edge_linker_params() override= default;
71 
72   bool SanityCheck() override;
73 
74   friend std::ostream& operator<<(std::ostream&,const sdet_symbolic_edge_linker_params& dp);
75 
76 protected:
77 
78   void InitParams(double nrad, double gap, bool adap_uncer,
79                   double dx, double dt, unsigned curve_model,
80                   double token_len, double max_k, double max_gamma,
81                   unsigned grouping_algo, unsigned cvlet_type,
82                   unsigned app_usage, double app_thresh, unsigned max_size_to_group,
83                   bool formCompleteCvletMap, bool formLinkGraph,
84                   bool use_all_cvlet, unsigned linkgraph_algo,
85                   unsigned min_size_to_link, unsigned linking_algo,
86                   unsigned num_link_iters, bool get_final_contours);
87 
88 ///////////////////////
89 
90 
91  public:
92 
93   double nrad_, gap_, dx_, dt_;
94   bool badap_uncer_;
95   unsigned curve_model_type_;
96   double token_len_, max_k_, max_gamma_;
97 
98   unsigned grouping_algo_;
99   unsigned max_size_to_group_;
100   unsigned cvlet_type_;
101   bool bCentered_grouping_;
102   bool bBidirectional_grouping_;
103 
104   bool bFormCompleteCvletMap_;
105   bool bFormLinkGraph_;
106   bool b_use_all_cvlets_;
107   unsigned app_usage_;
108   double app_thresh_;
109 
110   unsigned linkgraph_algo_;
111   unsigned min_size_to_link_;
112 
113   unsigned linking_algo_;
114   unsigned num_link_iters_;
115 
116   bool bGetfinalcontours_;
117 };
118 
119 #endif // sdet_symbolic_edge_linker_params_h_
120