00001
00002
00003 #ifndef _FDETECT_HARRIS_DESCRIPTOR_HPP_
00004 #define _FDETECT_HARRIS_DESCRIPTOR_HPP_
00005
00006 #include <boost/archive/text_oarchive.hpp>
00007 #include <boost/archive/text_iarchive.hpp>
00008
00009 #include "fdetect/Descriptor.hpp"
00010
00011 namespace jafar {
00012 namespace fdetect {
00018 class HarrisDescriptor : public fdetect::Descriptor {
00019 public:
00020 HarrisDescriptor(jafar::fdetect::InterestFeature* ip,
00021 double high,
00022 double low,
00023 jafar::image::Image const& image,
00024 int halfwinsize = 4);
00025 virtual Descriptor* clone() { return new HarrisDescriptor(*this); }
00026 virtual double weakComparison(jafar::fdetect::Descriptor *) const;
00027 virtual double strongComparison(jafar::fdetect::Descriptor *, double angle) const;
00028 virtual void print(std::ostream& s) const {
00029 s << " Mean: " << m_mean << " Sigma: " << m_sigma << " High: " << m_high << " Low: " << m_low << " gPixel: " << m_gPixel;
00030 }
00032 inline double high() const { return m_high; }
00034 inline double low() const { return m_low; }
00036 inline double gPixel() const { return m_gPixel; }
00037 inline void setGPixel(double v) { m_gPixel = v; }
00039 inline double gGradx() const { return m_gGradx; }
00040 inline void setGGradx(double v) { m_gGradx = v; }
00042 inline double gGrady() const { return m_gGrady; }
00043 inline void setGGrady(double v) { m_gGrady = v; }
00045 inline double mean() const { return m_mean; }
00046 inline double sigma() const { return m_sigma; }
00048 inline jafar::image::Image image() const { return m_image; }
00050 inline int halfWindowSize() const { return m_halfwinsize; }
00051 void setHalfWindowSize(int halfwinsize) { m_halfwinsize = halfwinsize; }
00052
00053 private:
00054 double m_high, m_low, m_gPixel, m_gGradx, m_gGrady;
00055 jafar::image::Image const& m_image;
00056 jafar::image::Image subpositionnedimg;
00057 int m_halfwinsize, m_zncc_count;
00058 double m_mean, m_sigma;
00060 friend class boost::serialization::access;
00061 template<class Archive>
00062 void serialize(Archive &ar, const unsigned int version)
00063 {
00064 ar & m_high;
00065 ar & m_low;
00066 ar & m_gPixel;
00067 ar & m_gGradx;
00068 ar & m_gGrady;
00069 ar & m_image;
00070 ar & subpositionnedimg;
00071 ar & m_halfwinsize;
00072 ar & m_zncc_count;
00073 ar & m_mean;
00074 ar & m_sigma;
00075 }
00076 };
00077
00078 }
00079
00080 namespace fdetect_v2 {
00086 class HarrisDescriptor : public Descriptor {
00087 public:
00088 HarrisDescriptor(double high,
00089 double low,
00090 double u,
00091 double v,
00092 jafar::image::Image const& image,
00093 int halfwinsize = 4);
00094 double weakComparison(const jafar::fdetect_v2::HarrisDescriptor&) const;
00095 double strongComparison(const jafar::fdetect_v2::HarrisDescriptor& d, double angle) const;
00097 inline double high() const { return m_high; }
00099 inline double low() const { return m_low; }
00101 inline double gPixel() const { return m_gPixel; }
00102 inline void setGPixel(double v) { m_gPixel = v; }
00104 inline double gGradx() const { return m_gGradx; }
00105 inline void setGGradx(double v) { m_gGradx = v; }
00107 inline double gGrady() const { return m_gGrady; }
00108 inline void setGGrady(double v) { m_gGrady = v; }
00110 inline double mean() const { return m_mean; }
00111 inline double sigma() const { return m_sigma; }
00113 inline jafar::image::Image image() const { return m_image; }
00115 inline int halfWindowSize() const { return m_halfwinsize; }
00116 void setHalfWindowSize(int halfwinsize) { m_halfwinsize = halfwinsize; }
00117 virtual Type type()
00118 {
00119 return Descriptor::HARRIS;
00120 };
00121
00122 private:
00123 double m_high, m_low, m_gPixel, m_gGradx, m_gGrady, m_u, m_v;
00124 jafar::image::Image const& m_image;
00125 jafar::image::Image subpositionnedimg;
00126 int m_halfwinsize, m_zncc_count;
00127 double m_mean, m_sigma;
00129 friend class boost::serialization::access;
00130 template<class Archive>
00131 void serialize(Archive &ar, const unsigned int version)
00132 {
00133 ar & m_high;
00134 ar & m_low;
00135 ar & m_gPixel;
00136 ar & m_gGradx;
00137 ar & m_gGrady;
00138 ar & m_image;
00139 ar & subpositionnedimg;
00140 ar & m_halfwinsize;
00141 ar & m_zncc_count;
00142 ar & m_mean;
00143 ar & m_sigma;
00144 }
00145 };
00146
00147 std::ostream& operator<<(std::ostream& s, const HarrisDescriptor& hd);
00148 }
00149 }
00150
00151 #endif