#include <HxExportExtraIdentMaskCentralMoments.h>
Public Types | |
typedef HxTagTransVar | TransVarianceCategory |
Functor is translation variant. More... | |
typedef HxTagNPhase | PhaseCategory |
N phases. More... | |
Public Methods | |
HxExportExtraIdentMaskCentralMoments (HxTagList &tags) | |
Constructor. More... | |
~HxExportExtraIdentMaskCentralMoments () | |
Destructor. More... | |
int | nrPhases () const |
The number of phases. More... | |
void | init (int phase) |
Start of given phase. More... | |
void | doIt (const ImValT &imV, const ExtraValT &extraV, int x, int y, int z) |
Processing one pixel. More... | |
void | done (int phase) |
End of given phase. More... | |
Static Public Methods | |
HxString | className () |
The name : "identMaskCentralMoments". More... |
* Upq = Sum[ (x - xBar)^p * (y - yBar)^q * f(x,y) ] * x,y * * with xBar = M10 / M00 (moments!) * and yBar = M01 / M00 (moments!) * M00 = Sum [f(x,y)], M10 = Sum [x * f(x,y)], M01 = Sum [y * f(x,y)] * * The order in the resulting list is determined by: * * for (int q=0 ; q<=N ; q++) * for (int p=0 ; p<=N ; p++) * if (p+q <= N) * [Upq]; * * For N=1 the order is: U00, U10, U01 * For N=2 the order is: U00, U10, U20, U01, U11, U02 * For N=3 the order is: U00, U10, U20, U30, U01, U11, U21, U02, U12, U03. *
|
Functor is translation variant.
|
|
N phases.
|
|
Constructor.
00092 : _tags(tags) 00093 { 00094 _maskVal = HxGetTag<int>(tags, "maskVal"); 00095 _order = HxGetTag<int>(tags, "order"); 00096 _valList = HxGetTag<HxValueList*>(tags, "valList"); 00097 _number = ((_order+1)*(_order+2))/2; 00098 _sums = new ResultT[_number]; 00099 ResultT *ptr = _sums; 00100 for (int i=0 ; i<_number; i++) 00101 *ptr++ = HxScalarInt(0); 00102 } |
|
Destructor.
00107 { 00108 HxValueListBackInserter res = std::back_inserter(*_valList); 00109 for (int i=0 ; i<_number ; i++) 00110 *res++ = HxValue(_sums[i]); 00111 delete _sums; 00112 } |
|
The number of phases.
00117 { 00118 return 2; 00119 } |
|
Start of given phase.
00124 { 00125 _curPhase = phase; 00126 if (phase == 1) { 00127 _m00 = HxScalarInt(0); 00128 _m10 = HxScalarInt(0); 00129 _m01 = HxScalarInt(0); 00130 } else { 00131 _xBar = _m10 / _m00; 00132 _yBar = _m01 / _m00; 00133 } 00134 } |
|
Processing one pixel.
00140 { 00141 if (extraV != _maskVal) 00142 return; 00143 if (_curPhase == 1) { 00144 _m00 += imV; 00145 _m10 += ResultT(HxScalarDouble(x)) * ResultT(imV); 00146 _m01 += ResultT(HxScalarDouble(y)) * ResultT(imV); 00147 } else { 00148 ResultT xx = ResultT(HxScalarDouble(x)) - _xBar; 00149 ResultT yy = ResultT(HxScalarDouble(y)) - _yBar; 00150 int i=0; 00151 for (int q=0 ; q<=_order ; q++) { 00152 for (int p=0 ; p<=_order ; p++) { 00153 if (p+q <= _order) { 00154 _sums[i] += xx.pow(HxScalarInt(p)) * yy.pow(HxScalarInt(q)) * ResultT(imV); 00155 i++; 00156 } 00157 } 00158 } 00159 } 00160 } |
|
End of given phase.
00165 { 00166 } |
|
The name : "identMaskCentralMoments".
00171 { 00172 return HxString("identMaskCentralMoments"); 00173 } |