contrib/brl/bseg/sdet/sdet_fit_lines.h
Go to the documentation of this file.
00001 // This is brl/bseg/sdet/sdet_fit_lines.h
00002 #ifndef sdet_fit_lines_h_
00003 #define sdet_fit_lines_h_
00004 //---------------------------------------------------------------------
00005 //:
00006 // \file
00007 // \brief a processor for fitting line segments to edges
00008 //
00009 //  This line fitting algorithm is based on the original Charlie Rothwell
00010 //  detector as ported by FSM in osl.  This version does incremental 
00011 //  fitting to a chain of points and produces a 
00012 //  vcl_vector<vgl_line_segments_2d>. The actual fitting algorithm is 
00013 //  in vgl/algo and therefore should be of wider applicability.
00014 // 
00015 // \author
00016 //  J.L. Mundy - April 10, 2003
00017 //
00018 // \verbatim
00019 //  Modifications
00020 //   <none>
00021 // \endverbatim
00022 //
00023 //-------------------------------------------------------------------------
00024 #include <vcl_vector.h>
00025 #include <vgl/algo/vgl_fit_lines_2d.h>
00026 #include <vsol/vsol_line_2d_sptr.h>
00027 #include <vtol/vtol_edge_2d_sptr.h>
00028 #include <vgl/vgl_line_segment_2d.h>
00029 #include <sdet/sdet_fit_lines_params.h>
00030 
00031 class sdet_fit_lines : public sdet_fit_lines_params
00032 {
00033  public:
00034   //:Constructors/destructor
00035   sdet_fit_lines(sdet_fit_lines_params& rpp);
00036 
00037   ~sdet_fit_lines();
00038   //: Process methods
00039   bool fit_lines();
00040   void clear();
00041   //: Accessors
00042   void set_edges(vcl_vector<vtol_edge_2d_sptr> const& edges);
00043   vcl_vector<vsol_line_2d_sptr> get_line_segs();
00044   void get_line_segs(vcl_vector<vsol_line_2d_sptr>& lines);
00045   void get_line_segs(vcl_vector<vgl_line_segment_2d<double> >& lines);
00046 
00047  protected:
00048   //:protected methods
00049 
00050   //:members
00051   bool segs_valid_;      //process state flag
00052   vcl_vector<vtol_edge_2d_sptr> edges_;// the input edges
00053   vgl_fit_lines_2d<double> fitter_;//the fitting class
00054   vcl_vector<vgl_line_segment_2d<double> > line_segs_;
00055 };
00056 
00057 #endif // sdet_fit_lines_h_