#include <HxNgbIsMaxGradDir2d.h>
Public Types | |
| typedef HxTagCnum | IteratorCategory |
| Coordinate enumerated version. More... | |
| typedef HxTag1Phase | PhaseCategory |
| 1 phase. More... | |
| typedef HxCnum | CnumType |
| Coordinate enumerator type. More... | |
Public Methods | |
| HxNgbIsMaxGradDir2d (HxTagList &tags) | |
| Constructor. More... | |
| ~HxNgbIsMaxGradDir2d () | |
| Destructor. More... | |
| HxSizes | size () |
| Size of the neighbourhood. More... | |
| CnumType | begin () |
| The first of the coordinates. More... | |
| CnumType | end () |
| The last of the coordinates. More... | |
| void | init (int x, int y, const ArithT &value) |
| Initialization. More... | |
| void | next (int x, int y, const ArithT &value) |
| Processing one pixel. More... | |
| ResultT | result () const |
| Produce the result value. More... | |
Static Public Methods | |
| HxString | className () |
| The name : "isMaxGradDir". More... | |
If the current pixel is smaller than the two pixels in the gradient and opposite direction it is set to 0. ArithT is required to be a 2 dimensional vector.
|
|||||
|
Coordinate enumerated version.
|
|
|||||
|
1 phase.
|
|
|||||
|
Coordinate enumerator type.
|
|
||||||||||
|
Constructor.
00028 {
00029 _coords = &_coordPairs[0];
00030 _level = HxScalarDouble(HxGetTag<HxValue>(tags, "level", HxValue(3.0))).x();
00031 if (_level < 0)
00032 _level = 0;
00033 _level *= _level;
00034 }
|
|
|||||||||
|
Destructor.
00038 {
00039 }
|
|
|||||||||
|
Size of the neighbourhood.
00137 {
00138 return HxSizes(3, 3, 1);
00139 }
|
|
|||||||||
|
The first of the coordinates.
00075 {
00076 return CnumType(&_coords[0]);
00077 }
|
|
|||||||||
|
The last of the coordinates.
00082 {
00083 return CnumType(&_coords[_endIdx]);
00084 }
|
|
||||||||||||||||||||
|
Initialization.
00089 {
00090 static const double tan22_5 = 0.41421356;
00091 static const double tan67_5 = 2.41421356;
00092
00093 double x(v.x()), y(v.y());
00094 _resultMag = x*x+y*y;
00095
00096 if (_resultMag < _level)
00097 {
00098 _endIdx = 0;
00099 return;
00100 }
00101
00102 if (x == 0)
00103 {
00104 _endIdx = 2;
00105 _coords = &_coordPairs[4];
00106 return;
00107 }
00108
00109 double rc = y/x;
00110 double frc = fabs(rc);
00111 int i = (frc < tan22_5) ? 0 : ( (frc < tan67_5) ? 1 : 2 );
00112 if (rc < 0)
00113 i += 3;
00114 _endIdx = 2;
00115 _coords = &_coordPairs[i<<1];
00116 }
|
|
||||||||||||||||||||
|
Processing one pixel.
00129 {
00130 if ((v.x()*v.x() + v.y()*v.y()) > _resultMag)
00131 _resultMag = 0;
00132 }
|
|
|||||||||
|
Produce the result value.
00144 {
00145 return _resultMag >= _level ? 1 : 0;
00146 }
|
|
|||||||||
|
The name : "isMaxGradDir".
00121 {
00122 static HxString s("isMaxGradDir");
00123 return s;
00124 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001