25 #include "CornerDetectorHarris.hh"
36 template <
class StorageType,
class CalculationType>
44 template <
class StorageType,
class CalculationType>
50 template <
class StorageType,
class CalculationType>
int
55 int tlx, tly, brx, bry;
56 this->_sgxx.GetROI()->GetCorners(tlx, tly, brx, bry);
59 const unsigned int minx=tlx;
60 const unsigned int miny=tly;
61 const unsigned int maxx=brx;
62 const unsigned int maxy=bry;
64 const unsigned int width=Cornerness.
GetWidth();
68 CalculationType **psgxx=this->_sgxx.GetImageDataArray(),
69 **psgyy=this->_sgyy.GetImageDataArray(),
70 **psgxy=this->_sgxy.GetImageDataArray();
71 CalculationType *ptr, *end, tmp;
74 float scale = float ( _Scale );
76 unsigned offs = width*miny;
80 const double me=(double)this->_MinCornerness;
82 this->_FeatList.clear();
83 this->_FeatList.reserve(end-ptr);
85 for (y=miny; y<maxy; y++){
86 for (x=minx; x<maxx; x++){
87 const CalculationType xx = (CalculationType)psgxx[y][x];
88 const CalculationType xy = (CalculationType)psgxy[y][x];
89 const CalculationType yy = (CalculationType)psgyy[y][x];
92 tmp = (CalculationType) (xx*yy-xy*xy - scale * (xx+yy) * (xx+yy));
98 fp.val=(tmp>(double)INT_MAX)?(INT_MAX):((
int)tmp);
99 this->_FeatList.push_back(fp);
120 #ifdef BUILD_IMAGE_INT
123 #ifdef BUILD_IMAGE_CHAR
126 #ifdef BUILD_IMAGE_SHORT
128 #ifdef BUILD_IMAGE_USHORT
130 #ifdef BUILD_IMAGE_INT
134 #ifdef BUILD_IMAGE_UINT
136 #ifdef BUILD_IMAGE_DOUBLE
Harris corner detector, detects grey value corners in images.
int SetCorners(unsigned UpperLeftX, unsigned UpperLeftY, unsigned LowerRightX, unsigned LowerRightY)
Sets a rectangular region of interest.
double _Scale
weight of trace in harris approximation
unsigned int GetWidth() const
virtual int _ComputeCornerness(Image< CalculationType > &Cornerness)
Computes the Harris approximation of the smaller eigenvalue of the structure tensor A over the image ...
ROI * GetROI()
Returns a pointer to the roi object.
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
base class for all gradient based corner detectors