contrib/brl/bseg/sdet/sdet_image_mesh.h
Go to the documentation of this file.
00001 // This is brl/bseg/sdet/sdet_image_mesh.h
00002 #ifndef sdet_image_mesh_h_
00003 #define sdet_image_mesh_h_
00004 //---------------------------------------------------------------------
00005 //:
00006 // \file
00007 // \brief a processor for triangulating a images based on detected line segments
00008 //
00009 //  This algorithm triangulates an image into a 3-d mesh based on
00010 //  detected line segments. The line segments are fit to edge detection
00011 //  contour chains.
00012 //
00013 // \author
00014 //  J.L. Mundy - March 21, 2011
00015 //
00016 // \verbatim
00017 //  Modifications
00018 //   <none>
00019 // \endverbatim
00020 //
00021 //-------------------------------------------------------------------------
00022 #include <vcl_vector.h>
00023 #include <vgl/vgl_line_segment_2d.h>
00024 #include <sdet/sdet_image_mesh_params.h>
00025 #include <imesh/imesh_mesh.h>
00026 #include <vil/vil_image_resource.h>
00027 #include <vil/vil_image_view.h>
00028 
00029 class sdet_image_mesh : public sdet_image_mesh_params
00030 {
00031  public:
00032   // === Constructors/destructor ===
00033   sdet_image_mesh(sdet_image_mesh_params& imp);
00034   ~sdet_image_mesh();
00035 
00036   // === Process methods ===
00037   void set_image(vil_image_resource_sptr const& resource);
00038   bool compute_mesh();
00039 
00040   // === Accessors ===
00041   imesh_mesh& get_mesh() { return mesh_; }
00042   bool mesh_valid() const { return mesh_valid_; }
00043 
00044  protected:
00045   // === protected methods ===
00046   bool step_boundary(vgl_line_segment_2d<double> const& parent,
00047                      vgl_line_segment_2d<double>& child0,
00048                      vgl_line_segment_2d<double>& child1);
00049   void set_anchor_points(imesh_mesh& mesh, vil_image_view<float> dt_img);
00050   bool compute_line_segments(vil_image_resource_sptr const& resc,
00051                              vcl_vector<vgl_line_segment_2d<double> >& segs);
00052 
00053   // === members ===
00054   bool mesh_valid_;      //: process state flag
00055   vil_image_resource_sptr resc_;
00056   imesh_mesh mesh_;
00057 };
00058 
00059 #endif // sdet_image_mesh_h_