correlation_observer2D.h

Go to the documentation of this file.
00001 #ifndef MMVL_CORRELATION_OBSERVER_2D_HH_INCLUDED
00002 #define MMVL_CORRELATION_OBSERVER_2D_HH_INCLUDED
00003 
00004 #include <iostream>
00005 #include <string>
00006 #include <vector>
00007 
00008 #include "corrcoef.h"
00009 #include "image.h"
00010 #include "hypothesis2D.h"
00011 
00012 #define CLAMP(x,y,z) ((x<y) ? (x=y) : ((x>z) ? (x=z) : 0)) //put x into [y;z] range
00013 //put this as a private function
00014 
00015 namespace mimas{
00016   namespace hf{  
00017 
00039     template<typename Hypothesis_T, typename Pixel_T>
00040     class correlation_observer2D
00041       {
00042       public:
00043   class set{
00044   public:
00045     int x;
00046     int y;
00047     int KER_W;
00048     int KER_H;
00049     
00050     set(int x, int y,int ker_w, int ker_h)
00051       :x(x), y(y), KER_W(ker_w), KER_H(ker_h){}
00052   };
00053   
00054   correlation_observer2D(image< Pixel_T > &image, set co_set):
00055     image_private(image), KER_W(co_set.KER_W), KER_H(co_set.KER_H)
00056   {
00057     kernel_image.init(co_set.KER_W, co_set.KER_H);
00058     set_correlation_observer_members(co_set.x, co_set.y);
00059   }
00060 
00061   image<int> kernel_image; 
00062 
00063   double convolvePoint(const int x, const int y) const;
00064 
00065   void set_correlation_observer_members(const int x,const int y);
00066   
00067   void observe(Hypothesis_T &p);
00068 
00070   //the observer is more likely to have the information necessary
00071   //to do it might change latter
00072   //this function can be used to display the result of analyse from an analyse_result policy
00073         void draw(const hypothesis2D &h)
00074   {
00075     int DOT_SIZE = 7;
00076     int color = 127;
00077     
00078     std::cerr<<"tracking value is: " <<h.x<< ", " <<h.y << std::endl;
00079 
00080     for(int i = -DOT_SIZE/2; i< DOT_SIZE/2; i++)
00081       for(int j = -DOT_SIZE/2; j< DOT_SIZE/2; j++)
00082         {
00083     image_private.setPixel(int(h.x) + i, int(h.y) + j, Pixel_T(color));  
00084         }
00085   }
00086 
00087   void draw(std::vector<hypothesis2D> &hypotheses)
00088   {
00089     typename std::vector<Hypothesis_T>::iterator it_h;
00090     
00091     for(it_h = hypotheses.begin(); it_h != hypotheses.end(); it_h++)
00092       draw(*it_h);
00093   }
00094 
00095       private:
00096 
00097   image<Pixel_T> &image_private; 
00098   int KER_W, KER_H;
00099   
00100   std::vector<int> kernel;
00101   
00102       };
00103 #include "correlation_observer2D.tcc"    
00104   }
00105 } 
00106 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:16 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...