contrib/oxl/mvl/HomgInterestPointSet.h
Go to the documentation of this file.
00001 // This is oxl/mvl/HomgInterestPointSet.h
00002 #ifndef HomgInterestPointSet_h_
00003 #define HomgInterestPointSet_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Set of interest points on an image
00010 //
00011 // HomgInterestPointSet holds a set of corners (or points of interest) computed
00012 // from an image.  The current implementation provides a moderately
00013 // abstract interface, but assumes that it is efficient to associate
00014 // an index with each corner.  I \e know this ought to be elsewhere.
00015 //
00016 // \author
00017 //     Andrew W. Fitzgibbon, Oxford RRG, 17 Aug 96
00018 //
00019 // \verbatim
00020 //  Modifications:
00021 //   Peter Vanroose - 27 aug.97 - moved vcl_vector<HomgInterestPoint> instantiation to Templates
00022 //   Peter Vanroose - 22 oct.02 - added vgl_homg_point_2d interface
00023 // \endverbatim
00024 //-----------------------------------------------------------------------------
00025 
00026 #include <vcl_vector.h>
00027 #include <vcl_iosfwd.h>
00028 
00029 #include <vnl/vnl_double_2.h>
00030 #include <vgl/vgl_homg_point_2d.h>
00031 
00032 #include <mvl/HomgPoint2D.h>
00033 #include <mvl/HomgMetric.h>
00034 
00035 class vil1_image;
00036 class ImageMetric;
00037 class HomgInterestPointSetData;
00038 class HomgInterestPoint;
00039 
00040 class HomgInterestPointSet
00041 {
00042   // Data Members--------------------------------------------------------------
00043   HomgInterestPointSetData* data_;
00044   HomgMetric conditioner_;
00045 
00046  public:
00047   // Constructors/Destructors--------------------------------------------------
00048 
00049   HomgInterestPointSet();
00050   HomgInterestPointSet(const HomgMetric&);
00051   HomgInterestPointSet(const char* filename, const HomgMetric& = 0);
00052   HomgInterestPointSet(const vcl_vector<HomgPoint2D>&, ImageMetric* conditioner);
00053   HomgInterestPointSet(vcl_vector<vgl_homg_point_2d<double> > const&, ImageMetric* conditioner);
00054   HomgInterestPointSet(const HomgInterestPointSet& that);
00055  ~HomgInterestPointSet();
00056 
00057   HomgInterestPointSet& operator=(const HomgInterestPointSet& that);
00058 
00059   // Operations----------------------------------------------------------------
00060   // void set(const IUPointGroup&, const HomgMetric& c);
00061 
00062   // Data Access---------------------------------------------------------------
00063   unsigned size() const;
00064 
00065   //: Return i'th interest pt.
00066   const HomgPoint2D& operator[](int i) const { return get_homg(i); }
00067 
00068   HomgInterestPoint& get(int i);
00069   HomgInterestPoint const& get(int i) const;
00070   vnl_double_2 const& get_2d(int i) const;
00071   vnl_vector_fixed<int,2> const& get_int(int i) const;
00072   HomgPoint2D const& get_homg(int i) const;
00073   vgl_homg_point_2d<double> homg_point(int i) const;
00074   float              get_mean_intensity(int i) const;
00075 
00076   vcl_vector<HomgPoint2D> const & get_homg_points() const;
00077   vcl_vector<vgl_homg_point_2d<double> > homg_points() const;
00078 
00079   const ImageMetric* get_conditioner() const { return (const ImageMetric*)conditioner_; }
00080   void set_conditioner(const HomgMetric& c);
00081 
00082   // Data Control--------------------------------------------------------------
00083   bool add(double x, double y); // image coordinates
00084   bool add(const HomgPoint2D&);
00085   bool add(vgl_homg_point_2d<double> const&);
00086   bool add(const HomgInterestPoint&);
00087   bool add_preconditioned(const HomgPoint2D&);
00088   bool add_preconditioned(vgl_homg_point_2d<double> const&);
00089   void set_image(vil1_image const& image);
00090   void clear();
00091 
00092   // Input/Output--------------------------------------------------------------
00093   bool read(const char* filename, const HomgMetric& c = 0);
00094   bool read(const char* filename, vil1_image const& src, const HomgMetric& c = 0);
00095   bool write(const char* filename) const;
00096 
00097   bool read(vcl_istream& f, const ImageMetric* c);
00098   bool write(vcl_ostream& f, const ImageMetric* c) const;
00099 
00100  protected:
00101   void init_conditioner(const HomgMetric& c = 0);
00102   void delete_conditioner();
00103 };
00104 
00105 #endif // HomgInterestPointSet_h_