Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxKerNgbNormCorrelation Class Template Reference

Neighbourhood functor for normalized (cross) correlation filter. More...

#include <HxKerNgbNormCorrelation.h>

List of all members.

Public Types

typedef HxTagLoop IteratorCategory
 Loop version. More...

typedef HxTag2Phase PhaseCategory
 2 phases. More...


Public Methods

 HxKerNgbNormCorrelation (HxTagList &tags)
 Constructor. More...

 ~HxKerNgbNormCorrelation ()
 Destructor. More...

HxSizes size ()
 Size of the neighbourhood. More...

void init (int ix, int iy, ArithT imVal)
 Initialization first phase. More...

void next (int x, int y, ArithT pixV, ArithT maskV)
 Processing one pixel in first phase. More...

void init2 (int ix, int iy, ArithT imVal)
 Initialization second phase. More...

void next2 (int x, int y, ArithT pixV, ArithT maskV)
 Processing one pixel in second phase. More...

ResultT result ()
 Produce the result value. More...


Static Public Methods

HxString className ()
 The name : "normalizedCorrelation". More...


Detailed Description

template<class ArithT, class ResultT>
class HxKerNgbNormCorrelation< ArithT, ResultT >

Neighbourhood functor for normalized (cross) correlation filter.

Formula:

\begin{verbatim} Sum[f(x,y) - fBar(x,y)][w(x,y) - wBar] x,y --------------------------------------------------------- Sqrt[ Sum[f(x,y) - fBar(x,y)]^2 * Sum[w(x,y) - wBar]^2 ] x,y x,y \end{verbatim}


Member Typedef Documentation

template<class ArithT, class ResultT>
typedef HxTagLoop HxKerNgbNormCorrelation::IteratorCategory
 

Loop version.

template<class ArithT, class ResultT>
typedef HxTag2Phase HxKerNgbNormCorrelation::PhaseCategory
 

2 phases.


Constructor & Destructor Documentation

template<class ArithT, class ResultT>
HxKerNgbNormCorrelation< ArithT, ResultT >::HxKerNgbNormCorrelation HxTagList   tags
 

Constructor.

00019 {
00020     _ngbSize = HxGetTag(tags, "kernelSize", HxSizes(0, 0, 0));
00021 }

template<class ArithT, class ResultT>
HxKerNgbNormCorrelation< ArithT, ResultT >::~HxKerNgbNormCorrelation  
 

Destructor.

00025 {
00026 }


Member Function Documentation

template<class ArithT, class ResultT>
HxSizes HxKerNgbNormCorrelation< ArithT, ResultT >::size  
 

Size of the neighbourhood.

00039 {
00040     return _ngbSize;
00041 }

template<class ArithT, class ResultT>
void HxKerNgbNormCorrelation< ArithT, ResultT >::init int    ix,
int    iy,
ArithT    imVal
[inline]
 

Initialization first phase.

00047 {
00048     _num = 0;
00049     _fBar = HxScalarDouble(0);
00050     _wBar = HxScalarDouble(0);
00051 }

template<class ArithT, class ResultT>
void HxKerNgbNormCorrelation< ArithT, ResultT >::next int    x,
int    y,
ArithT    pixV,
ArithT    maskV
[inline]
 

Processing one pixel in first phase.

00057 {
00058     _num += 1;
00059     _fBar += pixV;
00060     _wBar += maskV;
00061 }

template<class ArithT, class ResultT>
void HxKerNgbNormCorrelation< ArithT, ResultT >::init2 int    ix,
int    iy,
ArithT    imVal
[inline]
 

Initialization second phase.

00066 {
00067     _fBar = _fBar / (ResultT) _num;
00068     _wBar = _wBar / (ResultT) _num;
00069     _sumFW = HxScalarDouble(0);
00070     _sumFSqr = HxScalarDouble(0);
00071     _sumWSqr = HxScalarDouble(0);
00072 }

template<class ArithT, class ResultT>
void HxKerNgbNormCorrelation< ArithT, ResultT >::next2 int    x,
int    y,
ArithT    pixV,
ArithT    maskV
[inline]
 

Processing one pixel in second phase.

00077 {
00078     ResultT p = pixV, m = maskV;
00079     _sumFW += (p - _fBar) * (m - _wBar);
00080     _sumFSqr += (p - _fBar) * (p - _fBar);
00081     _sumWSqr += (m - _wBar) * (m - _wBar);
00082 }

template<class ArithT, class ResultT>
ResultT HxKerNgbNormCorrelation< ArithT, ResultT >::result   [inline]
 

Produce the result value.

00087 {
00088     ResultT tmp = _sumFSqr * _sumWSqr;
00089     tmp = tmp.sqrt();
00090     if (HxScalarInt(tmp) == HxScalarInt(0))
00091         return ResultT(HxScalarInt(0));
00092     return _sumFW / tmp;
00093 }

template<class ArithT, class ResultT>
HxString HxKerNgbNormCorrelation< ArithT, ResultT >::className   [static]
 

The name : "normalizedCorrelation".

00031 {
00032     static HxString name("normalizedCorrelation");
00033     return name;
00034 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 14:19:05 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001