Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

TraitInOutHistogram1d.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Histogram_TraitInOutHistogram1d_h
00002 #define Impala_Core_Histogram_TraitInOutHistogram1d_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Histogram
00011 {
00012 
00013 
00014 template <class HistT, class ArrayT>
00015 class TraitInOutHistogram1d
00016 {
00017 public:
00018 
00019     typedef Array::Pattern::TagPixOpOut    DirectionCategory;
00020     typedef Array::Pattern::TagTransInVar  TransVarianceCategory;
00021     typedef Array::Pattern::Tag1Phase      PhaseCategory;
00022 
00023     typedef typename ArrayT::ArithType ArithType;
00024 
00025     TraitInOutHistogram1d(HistT* histogram)
00026     {
00027         mHistogram = histogram;
00028     }
00029 
00030     void
00031     DoIt(ArithType value)
00032     {
00033         mHistogram->AddWeightSafe(value);
00034     }
00035 
00036     void
00037     DoIt(ArithType value, ArithType weight)
00038     {
00039         mHistogram->AddWeightSafe(value, weight);
00040     }
00041 
00042     HistT* mHistogram;
00043 
00044 };
00045 
00046 /*
00047 class InOutHistogram1dGaussian
00048 {
00049 public:
00050 
00051     typedef CxTagCallValue   CallCategory;
00052     typedef CxTagPixOpOut    DirectionCategory;
00053     typedef CxTagTransVar    TransVarianceCategory;
00054     typedef CxTag1Phase      PhaseCategory;
00055 
00056     CxInOutHistogram1dGaussian(CxHistogram1d* histogram)
00057     {
00058         mHistogram = histogram;
00059         mWeightX = 0;
00060         mWeightY = 0;
00061     }
00062 
00063     ~CxInOutHistogram1dGaussian()
00064     {
00065         if(mWeightX)
00066             delete mWeightX;
00067         if(mWeightY)
00068             delete mWeightY;
00069     }
00070 
00071     void Initialise(int w, int h, double sigma, double meanx, double meany)
00072     {
00073         int i;
00074         double norm = 1.0 / (sqrt(2.0 * M_PI) * sigma);
00075 
00076         if(mWeightX)
00077             delete mWeightX;
00078         mWeightX = new double[w];
00079         for (i=0 ; i<w ; i++) 
00080         {
00081             double weight = (i-meanx)/sigma;
00082             mWeightX[i] = norm*exp(-0.5*weight*weight);
00083         }
00084 
00085         if(mWeightY)
00086             delete mWeightY;
00087         mWeightY = new double[h];
00088         for (i=0 ; i<h ; i++) 
00089         {
00090             double weight = (i-meany)/sigma;
00091             mWeightY[i] = norm*exp(-0.5*weight*weight);
00092         }
00093     }
00094 
00095     void DoIt(double d, int x, int y)
00096     {
00097         double w = mWeightX[x] * mWeightY[y];
00098         mHistogram->AddWeightSafe(d, w);
00099     }
00100 
00101 
00102     CxHistogram1d* mHistogram;
00103     double* mWeightX;
00104     double* mWeightY;
00105 };
00106 */
00107 
00108 } // namespace Histogram
00109 } // namespace Core
00110 } // namespace Impala
00111 
00112 #endif

Generated on Fri Mar 19 09:31:10 2010 for ImpalaSrc by  doxygen 1.5.1