contrib/gel/vifa/vifa_parallel.h
Go to the documentation of this file.
00001 // This is gel/vifa/vifa_parallel.h
00002 #ifndef VIFA_PARALLEL_H
00003 #define VIFA_PARALLEL_H
00004 
00005 //-----------------------------------------------------------------------------
00006 //:
00007 // \file
00008 // \brief Class for parallel line calculations.
00009 //
00010 // \author Roddy Collins, from DDB in TargetJr
00011 //
00012 // \verbatim
00013 //  Modifications:
00014 //   MPP Mar 2003, Ported to VXL
00015 // \endverbatim
00016 //-----------------------------------------------------------------------------
00017 
00018 #include <vcl_vector.h>
00019 #include <vtol/vtol_intensity_face_sptr.h>
00020 #include <vtol/vtol_edge_2d.h>
00021 #include <vifa/vifa_histogram.h>
00022 #include <vifa/vifa_parallel_params.h>
00023 #include <vifa/vifa_typedefs.h>
00024 
00025 
00026 //: Compute the parallel-ness of a set of line segments
00027 // NOTE: All angles are in degrees.
00028 class vifa_parallel: public vifa_parallel_params
00029 {
00030  private:
00031   //: Raw histogram
00032   vifa_histogram*  raw_h_;
00033 
00034   //: Normalized histogram
00035   vifa_histogram*  norm_h_;
00036 
00037  public:
00038   //: Face-based constructor
00039   vifa_parallel(iface_list&      faces,
00040                 bool             contrast_weighted,
00041                 vifa_parallel_params*  params = 0
00042                );
00043 
00044   //: Orientation-based constructor
00045   vifa_parallel(vcl_vector<float>&  pixel_orientations,
00046                 vifa_parallel_params*  params = 0
00047                );
00048 
00049   //: Constructor based on line statistics
00050   vifa_parallel(float  center_angle,
00051                 float  std_dev
00052                );
00053 
00054   //: Destructor
00055   ~vifa_parallel(void);
00056 
00057   void  reset(void);
00058 
00059   vifa_histogram* get_raw_hist(void);
00060   vifa_histogram* get_norm_hist(void);
00061 
00062   void  map_gaussian(float&  max_angle,
00063                      float&  std_dev,
00064                      float&  scale
00065                     );
00066   void  remove_gaussian(float  max_angle,
00067                         float  std_dev,
00068                         float  scale
00069                        );
00070   void  snapshot(char* fname);
00071   float  area(void);
00072   float  bin_variance(void);
00073 
00074  private:
00075   float           map_x(float  raw_x);
00076   vifa_histogram* normalize_histogram(vifa_histogram*  h);
00077   float           find_peak(float&  max_value);
00078   vtol_intensity_face_sptr get_adjacent_iface(vtol_intensity_face_sptr known_face,
00079                                               vtol_edge_2d*            e);
00080 };
00081 
00082 
00083 #endif  // VIFA_PARALLEL_H