Go to the documentation of this file.00001
00002 #ifndef VIFA_INT_FACES_ATTR_H
00003 #define VIFA_INT_FACES_ATTR_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <vcl_vector.h>
00022 #include <vbl/vbl_smart_ptr.h>
00023 #include <vdgl/vdgl_fit_lines_params.h>
00024 #include <vtol/vtol_intensity_face_sptr.h>
00025 #include <vifa/vifa_histogram.h>
00026 #include <vifa/vifa_int_face_attr_common.h>
00027 #include <vifa/vifa_int_face_attr.h>
00028 #include <vifa/vifa_int_face_attr_factory.h>
00029 #include <vifa/vifa_parallel.h>
00030 #include <vifa/vifa_typedefs.h>
00031
00032
00033
00034
00035 #define NUM_HIST_ATTRIBUTES 15
00036
00037
00038 typedef float (vifa_int_face_attr::*AttrFuncPtr)();
00039
00040
00041 class vifa_int_faces_attr : public vifa_int_face_attr_common
00042 {
00043 protected:
00044 iface_list faces_;
00045
00046
00047
00048 attr_list attr_map_;
00049
00050 vcl_vector<float> centroid_;
00051 float perimeter_;
00052 float weighted_perimeter_;
00053
00054
00055
00056
00057 static AttrFuncPtr attr_get_funcs[];
00058 static const char* const attr_names[];
00059 static float attr_min_vals[];
00060
00061
00062
00063
00064
00065
00066
00067 incr_var_list attr_vec_;
00068
00069 float cached_2_parallel_;
00070 float cached_4_parallel_;
00071 float cached_80_parallel_;
00072 vifa_parallel* npobj_;
00073 vifa_int_face_attr_factory* factory_;
00074 public:
00075 vifa_int_faces_attr(vdgl_fit_lines_params* fitter_params = NULL,
00076 vifa_group_pgram_params* gpp_s = NULL,
00077 vifa_group_pgram_params* gpp_w = NULL,
00078 vifa_coll_lines_params* cpp = NULL,
00079 vifa_norm_params* np = NULL,
00080 vifa_int_face_attr_factory* factory = NULL
00081 );
00082 vifa_int_faces_attr(iface_list& v,
00083 vdgl_fit_lines_params* fitter_params = NULL,
00084 vifa_group_pgram_params* gpp_s = NULL,
00085 vifa_group_pgram_params* gpp_w = NULL,
00086 vifa_coll_lines_params* cpp = NULL,
00087 vifa_norm_params* np = NULL,
00088 vifa_int_face_attr_factory* factory = NULL
00089 );
00090
00091 virtual ~vifa_int_faces_attr();
00092
00093
00094
00095
00096
00097 virtual bool ComputeAttributes();
00098 virtual bool GetAttributes(vcl_vector<float>& attrs);
00099 static void GetAttributeNames(vcl_vector<vcl_string>& names);
00100 virtual bool GetNativeAttributes(vcl_vector<float>& attrs);
00101
00102
00103 virtual iface_list& GetFaces() { return faces_; }
00104 virtual void SetFaces(iface_list& v);
00105 edge_2d_list& GetEdges();
00106
00107
00108
00109 vifa_int_face_attr_sptr factory_new_attr(vtol_intensity_face_sptr face);
00110
00111
00112 float Xo();
00113
00114 float Yo();
00115
00116
00117
00118
00119
00120
00121
00122 float GetMeanAttr(int attr_index);
00123 float GetSDAttr(int attr_index);
00124 float GetMinAttr(int attr_index);
00125 float GetMaxAttr(int attr_index);
00126 static int NumHistAttributes() { return NUM_HIST_ATTRIBUTES; }
00127
00128
00129 float Area();
00130 float AspectRatio();
00131 float PerimeterLength();
00132 float Complexity();
00133 float WeightedComplexity();
00134 float WeightedPerimeterLength();
00135
00136 float TwoPeakParallel();
00137 float FourPeakParallel();
00138 float EightyPercentParallel();
00139
00140
00141 static float CallAttrFunction(vifa_int_face_attr* seed, int i);
00142
00143 static const char* GetBaseAttrName(int i);
00144
00145 protected:
00146 virtual void init();
00147 void SetNP();
00148 void ComputeCentroid();
00149 virtual bool ComputeSingleFaceAttributes(bool forceP=false);
00150
00151
00152 edge_list* GetPerimeterEdges();
00153 vifa_histogram_sptr MakeAttrHist(vcl_vector<float>& attr_vals);
00154 };
00155
00156 typedef vbl_smart_ptr<vifa_int_faces_attr> vifa_int_faces_attr_sptr;
00157
00158
00159 #endif // VIFA_INT_FACES_ATTR_H