Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vifa_int_faces_adj_attr.h

Go to the documentation of this file.
00001 // This is gel/vifa/vifa_int_faces_adj_attr.h
00002 #ifndef VIFA_INT_FACES_ADJ_ATTR_H
00003 #define VIFA_INT_FACES_ADJ_ATTR_H
00004 
00005 //-----------------------------------------------------------------------------
00006 //:
00007 // \file
00008 // \brief Collects statistics about a group of faces.
00009 // Collects statistics about a group of faces that have been grown from
00010 // a seed face.  Will either take a seed and grow the regions itself or
00011 // take a collection of faces on faith.
00012 //
00013 // *** WARNING *** Probably does not calculate neighborhoods correctly
00014 // for depths > 1 (probably includes the seed face back into the neighborhood.)
00015 //
00016 // \author Roddy Collins, from DDB in TargetJr
00017 //
00018 // \verbatim
00019 //  Modifications:
00020 //   MPP May 2003, Ported to VXL
00021 // \endverbatim
00022 //-----------------------------------------------------------------------------
00023 
00024 #include <vcl_vector.h>
00025 #include <vdgl/vdgl_fit_lines_params.h>
00026 #include <vtol/vtol_intensity_face_sptr.h>
00027 #include <vifa/vifa_coll_lines_params.h>
00028 #include <vifa/vifa_group_pgram_params.h>
00029 #include <vifa/vifa_int_faces_attr.h>
00030 #include <vifa/vifa_typedefs.h>
00031 
00032 
00033 class vifa_int_faces_adj_attr: public vifa_int_faces_attr
00034 {
00035  protected:
00036   enum
00037   {
00038     BAD_DEPTH = -1
00039   };
00040 
00041   bool            closure_valid_;
00042 
00043   vtol_intensity_face_sptr  seed_;
00044   vifa_int_face_attr_sptr    seed_attr_;
00045   int              depth_;
00046   int              size_filter_;
00047 
00048   float            junk_area_percentage_;
00049   int              junk_count_;
00050   float            junk_percent_;
00051   float            junk_area_ratio_;
00052 
00053   // attribute slots
00054 
00055   // ratios of seed attr to neighborhood mean
00056   vcl_vector<float>      mean_ratios_;
00057   vcl_vector<float>      min_ratios_;
00058 
00059  public:
00060   vifa_int_faces_adj_attr();
00061   vifa_int_faces_adj_attr(vtol_intensity_face_sptr  seed,
00062                           int              depth,
00063                           int              size_filter = -1,
00064                           vdgl_fit_lines_params*    fitter_params = NULL,
00065                           vifa_group_pgram_params*  gpp_s = NULL,
00066                           vifa_group_pgram_params*  gpp_w = NULL,
00067                           vifa_coll_lines_params*    cpp = NULL,
00068                           vifa_norm_params*      np = NULL,
00069                           vifa_int_face_attr_factory*  factory = NULL,
00070                           float          junk_area_percentage = 0.2
00071                          );
00072 
00073   vifa_int_faces_adj_attr(vtol_intensity_face_sptr  seed,
00074                           int                       depth,
00075                           iface_list&               neighborhood,
00076                           int                       size_filter  =  -1,
00077                           vdgl_fit_lines_params*    fitter_params  =  NULL,
00078                           vifa_group_pgram_params*  gpp_s  =  NULL,
00079                           vifa_group_pgram_params*  gpp_w  =  NULL,
00080                           vifa_coll_lines_params*   cpp  =  NULL,
00081                           vifa_norm_params*         np  =  NULL,
00082                           vifa_int_face_attr_factory*    factory  =  NULL,
00083                           float                     junk_area_percentage  =  0.2
00084                          );
00085 
00086   virtual iface_list&    GetFaces();
00087   iface_list*        GetFaceList();
00088 
00089   virtual bool  ComputeAttributes();
00090   virtual bool  GetAttributes(vcl_vector<float>&  attrs);
00091   static void    GetAttributeNames(vcl_vector<vcl_string>&  names);
00092   virtual bool  GetNativeAttributes(vcl_vector<float>&  attrs);
00093 
00094   vtol_intensity_face_sptr  GetSeed() const
00095     { return seed_; }
00096   void            SetSeed(vtol_intensity_face_sptr  seed);
00097 
00098   int    GetDepth() const
00099     { return depth_; }
00100   void  SetDepth(int depth)
00101     { depth_ = depth; closure_valid_ = false; }
00102 
00103   int    NeighborhoodSize();
00104 
00105   int    GetJunkCount()
00106     { return junk_count_; }
00107   float  GetJunkPercent()
00108     { return junk_percent_; }
00109   float  GetJunkAreaRatio()
00110     { return junk_area_ratio_; }
00111 
00112   bool  compute_closure();
00113   float  Collinearity();
00114 
00115   //
00116   // attribute gets here
00117   //
00118 
00119   // Ratio of seed to neighbors
00120   float  GetRatioAttr(int  attr_index);
00121 
00122   // Ratio of seed to min of neighbors
00123   float  GetMinRatioAttr(int  attr_index);
00124 
00125  protected:
00126   virtual void  init();
00127   bool  add_unique_face(iface_list&               facelist,
00128                         vtol_intensity_face_sptr  face,
00129                         int                       size_filter
00130                        );
00131   void  compute_closure_step(int                       current_depth,
00132                              vtol_intensity_face_sptr  seed
00133                             );
00134 
00135   // Retrieve the iface adjacent to a given iface at an edge (if available)
00136   vtol_intensity_face_sptr
00137     get_adjacent_face_at_edge(vtol_intensity_face_sptr&  known_face,
00138                               vtol_edge_2d*              e);
00139 
00140   // Retrieve all ifaces adjacent to a given face
00141   iface_list*  get_adjacent_faces(vtol_intensity_face_sptr&  known_face);
00142 };
00143 
00144 
00145 #endif  // VIFA_INT_FACES_ADJ_ATTR_H

Generated on Thu Jan 10 14:47:31 2008 for contrib/gel/vifa by  doxygen 1.4.4