pol_locator_hough.h

Go to the documentation of this file.
00001 // $Header: /cvs/mimas2/include/pol_locator_hough.h,v 1.1.1.1 2005/08/09 15:37:45 engmb Exp $
00002 #ifndef POL_LOCATOR_HOUGH_H
00003 #define POL_LOCATOR_HOUGH_H
00004 
00005 #include "mimasconfig.h"
00006 #include <boost/numeric/ublas/vector.hpp>
00007 #include <cmath>
00008 #include "image.h"
00009 #include "angle.h"
00010 #include "pol_locator.h"
00011 
00012 #define MAXVAL  0x7fff
00013 
00014 namespace mimas {
00015 class pol_model;
00016 class pol_match;
00017 
00042 class pol_angle
00043 {
00044     public:
00045     int16_t x,y;  
00046 
00047     pol_angle(int a)
00048     {
00049   x=y=(int16_t) a;
00050     }
00051 
00052     pol_angle(double v)
00053     {
00054   x=y=(int16_t) v;
00055     }
00056 
00057     pol_angle()
00058     {
00059   x=y=(int16_t) 0;
00060     }
00061 
00062     operator  int()
00063     {
00064   return (int)(x+y);
00065     }
00066 
00067     operator  double()
00068     {
00069   return (double)(x+y);
00070     }
00071 
00072 
00073     int mag()
00074     {
00075   double  dx=(double)x,dy=(double)y;
00076   return (int)sqrt(dx*dx+dy*dy);
00077     }
00078 
00079     int magSquared()
00080     {
00081   int ix=(int)x;
00082   int iy=(int)y;
00083   return (ix*ix+iy*iy);
00084     }
00085 };
00086 
00087 
00091 class pol_locator_hough : public pol_locator, public image<pol_angle>
00092 {
00093     protected:
00094   image<double> *bell_curve;
00095   double      thres;      
00096   double      ox,oy;
00097 
00098     public:
00099     typedef boost::numeric::ublas::vector< double > Vector;
00100   pol_locator_hough():
00101    bell_curve(0), thres(0), ox(0), oy(0)
00102   {}
00103   pol_locator_hough(double t):
00104    bell_curve(0), thres(t), ox(0), oy(0)
00105   {}
00106 
00107   ~pol_locator_hough()
00108   {
00109       if (bell_curve) delete bell_curve;
00110   }
00111 
00112 protected:
00118   int calcGaussBoxSize( double sigma, double accuracy );
00124   void  setLocation( int x, int y, double ca, double sa );
00125 
00131   void  initFastGauss( double sigma, double precision );
00132 
00137   void  addGaussPointFast( const Vector &posn, double w, double angle );
00138 
00139 public:
00140   /*
00141    * display the hough transform, i.e. for debugging
00142    *
00143    */
00144   // virtual void display( void );
00145 
00150   virtual void      init( int numdims, ...);
00151   virtual void      addEntry( double weight, ... );
00152   virtual pol_match_ptr_list getMatches();
00153   void        setOffset( double dx, double dy )
00154           { ox=dx; oy=dy; }
00155 
00156 };
00157 
00159 
00160 }
00161 
00162 #endif
00163 

[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:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...