#include <HxNgbLocalMode.h>
Public Types | |
| typedef HxTagLoop | IteratorCategory |
| Loop version. More... | |
| typedef HxTag1Phase | PhaseCategory |
| 1 phase. More... | |
Public Methods | |
| HxNgbLocalMode (HxTagList &tags) | |
| Constructor. More... | |
| HxSizes | size () |
| Size of the neighbourhood. More... | |
| void | init (int, int, const SrcT &, const SrcT &v2) |
| Initialization. More... | |
| void | check (int i, int j) |
| void | next (int x, int y, const SrcT &v1, const SrcT &) |
| Processing one pixel. More... | |
| DstT | result () const |
| Produce the result value. More... | |
Static Public Methods | |
| HxString | className () |
| The name : "localMode". More... | |
|
|||||
|
Loop version.
|
|
|||||
|
1 phase.
|
|
||||||||||
|
Constructor.
00039 {
00040 _size = HxGetTag(tags, "ngbSize", HxSizes(11, 11, 1));
00041 if (_size.x()<1&&_size.x()%2!=0&&_size.y()<1&&_size.y()%2!=0&&_size.z()!=1)
00042 throw HxString("Error: HxNgbLocalMode kernel must be 2D odd sized");
00043 hsx = (_size.x()+0)/2; // e.g. s=11, half=5, xin=[0..11> xwork=[-5..+5]
00044 hsy = (_size.y()+0)/2;
00045 _tags=tags;
00046 double sx = HxGetTag(tags, "sigmax", 2.0);
00047 double sy = HxGetTag(tags, "sigmay", 2.0);
00048 double sval = HxGetTag(tags, "sigmaval", 10.0);
00049 _sigmax = -0.5/sx/sx;
00050 _sigmay = -0.5/sy/sy;
00051 _sigmaval = -0.5/sval/sval;
00052 }
|
|
|||||||||
|
Size of the neighbourhood.
00056 {
00057 return _size;
00058 }
|
|
||||||||||||||||||||||||
|
Initialization.
00062 {
00063 _v2=v2;
00064 teller = HxScalarDouble(0.0);
00065 noemer=0.0;
00066 }
|
|
||||||||||||||||||||||||
|
Processing one pixel.
00076 {
00077 int i=x-hsx;
00078 int j=y-hsy;
00079 #ifdef _DEBUG
00080 check(i,j);
00081 #endif
00082 double po=0;
00083 po += i*i*_sigmax;
00084 po += j*j*_sigmay;
00085 po += norm2sqr(v1-_v2)*_sigmaval;
00086 double w=exp(po);
00087 teller += v1*DstT(HxScalarDouble(w));
00088 noemer += w;
00089 }
|
|
|||||||||
|
Produce the result value.
00093 {
00094 return teller/DstT(HxScalarDouble(noemer));
00095 }
|
|
|||||||||
|
The name : "localMode".
00099 {
00100 return HxString("localMode");
00101 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001