Chamfer2D_3x3.h

Go to the documentation of this file.
00001 
00029 #ifndef Chamfer2D_3x3_h
00030 #define Chamfer2D_3x3_h
00031 
00032 #include "DistanceTransform.h"
00033 //----------------------------------------------------------------------
00035 class Chamfer2D_3x3 : public DistanceTransform {
00036 
00037 public:
00038     Chamfer2D_3x3 ( const int xSize, const int ySize, const bool unload=true )
00039         : DistanceTransform(xSize, ySize, unload)
00040     {
00041     }
00042 
00048     void doTransform ( const unsigned char* const I ) {
00049         doTransform(I, 3, 3, 4, true);  //or (2,3)
00050     }
00051 
00062     void doTransform ( const unsigned char* const I, const int dx,
00063                        const int dy, const int dxy,
00064                        const bool halfIsZero );
00065 
00071     int iterateTransform ( const unsigned char* const I ) {
00072         return iterateTransform(I, 3, 3, 4, true);  //or (2,3)
00073     }
00074 
00080     int iterateTransform ( const unsigned char* const I, const int dx,
00081                        const int dy, const int dxy,
00082                        const bool halfIsZero );
00083 
00084     template <class T>
00085         inline bool check2 ( T* d, const int center, const int X, const int Y,
00086                              const T Delta ) {
00087             const int Near     = sub(X,Y);
00088             const T   possible = d[Near] + Delta;
00089             if (possible < d[center]) {
00090                 d[center] = possible;
00091                 return true;
00092             }
00093             return false;  //nothing changed
00094     }
00095 
00096 };
00097 
00098 #endif
00099 //----------------------------------------------------------------------

Generated on Thu Jan 12 10:28:41 2006 by  doxygen 1.4.5