#ifndef CORNINFO_HEADER #define CORNINFO_HEADER 1 ///////////////////////////////////////////////////////////////////// //! file="amma/Corner/Corner.hh" //! lib=CornerDet //! userlevel=Default //! author="eep1cg" //! date="26/11/96" //! docentry="default.eep1cg" // Corner/Corner.hh 18/12/95 By Charles Galambos //! rcsid="$Id: Corner.hh,v 1.3 2000/07/07 12:58:24 ees1cg Exp $" // Moderatly generic corner. #include "amma/Pixel.hh" #include "amma/Point2d.hh" #include "amma/GreyVal.hh" // Any better suggestions ? class CornerC { public: typedef RealT GradT ; CornerC() {} // Default constructor. CornerC(PixelC Cent,GradT ndx,GradT ndy,GreyValueT nGL) : CLoc(Cent) { Grad.X() = ndx; Grad.Y() = ndy; GL = nGL; } CornerC(const CornerC &Oth) : CLoc(Oth.CLoc), Grad(Oth.Grad), GL(Oth.GL) {} // Copy constructor. PixelC &Loc(void) { return CLoc; } // Get location of corner. const PixelC &Loc(void) const { return CLoc; } // Get location of corner. IndexT &GetX(void) { return CLoc.Col(); } // X component of corner location. IndexT &GetY(void) { return CLoc.Row(); } // Y component of corner location. Point2dC &GetGrad(void) { return Grad; } // Get gradient. const Point2dC &GetGrad(void) const { return Grad; } // Get gradient. GradT &DY(void) { return Grad.X(); } // X component of gradient. GradT &DX(void) { return Grad.Y(); } // Y component of gradient. GreyValueT &Level(void) { return GL; } // Grey level of pixel. const GreyValueT &Level(void) const { return GL; } // Grey level of pixel. IndexT Distance(PixelC &Oth) { return CLoc.CityBlockDistance(Oth); } // Distance from another pixel. inline RealT Distance(const CornerC &Oth) const; // A somewhat arbitary distance messure between two corners. // Suggestions for a better messure are welcome. void ForceCode(void); // Dummy routine, Ignore ! private: PixelC CLoc; // Location of corner. Point2dC Grad; // Gradient of point. GreyValueT GL; // Intensity of point. }; inline ostream &operator<<(ostream &out,const CornerC &corn) { out << corn.Loc() << " " << corn.GetGrad() << " " << corn.Level(); return out; } inline istream &operator>>(istream &in,CornerC &corn) { in >> corn.Loc() >> corn.GetGrad() >> corn.Level(); return in; } ////////////////////////////////////// // A somewhat arbitary distance messure between two corners. inline RealT CornerC::Distance(const CornerC &Oth) const { return CLoc.CityBlockDistance(Oth.CLoc) + Grad.AbsDistance(Oth.Grad) + abs(GL - Oth.GL); } #endif