contrib/tbl/vipl/vipl_gradient_dir.h
Go to the documentation of this file.
00001 #ifndef vipl_gradient_dir_h_
00002 #define vipl_gradient_dir_h_
00003 //:
00004 // \file
00005 // \brief atan2 of vipl_x_gradient and vipl_y_gradient
00006 //
00007 //   This image processing class is implemented using the vipl filters,
00008 //   which means that it can be used with any image class (IUE or not,
00009 //   TargetJr or not, vil or vil1 or not) of any pixel data type.
00010 //
00011 //   Note that the pixel types must support conversion from/to double
00012 //   where the atan2 computation takes place.
00013 //
00014 // \author Peter Vanroose, K.U.Leuven (ESAT/PSI)
00015 // \date   1 June 1998.
00016 //
00017 // \verbatim
00018 // Modifications:
00019 //   Peter Vanroose, Aug.2000 - adapted to vxl
00020 // \endverbatim
00021 //
00022 
00023 #include <vipl/filter/vipl_filter_2d.h> // parent class
00024 
00025 //: atan2 of vipl_x_gradient and vipl_y_gradient
00026 template <class ImgIn,class ImgOut,class DataIn,class DataOut, VCL_DFL_TYPE_PARAM_STLDECL(PixelItr, vipl_trivial_pixeliter) >
00027 class vipl_gradient_dir : public vipl_filter_2d<ImgIn,ImgOut,DataIn,DataOut,PixelItr>
00028 {
00029   // -+-+- data members: -+-+-
00030   // term to add to the atan2 result:
00031  private: double shift_;
00032  public: double shift() const { return shift_; }
00033   // scale factor to multiply the shifted atan2 with:
00034  private: double scale_;
00035  public: double scale() const { return scale_; }
00036 
00037   // -+-+- constructors/destructors: -+-+-
00038  public:
00039   inline vipl_gradient_dir(double s=1, double h=0)
00040            : vipl_filter_2d<ImgIn,ImgOut,DataIn,DataOut,PixelItr>(),
00041              shift_(h), scale_(s) {}
00042   inline vipl_gradient_dir(vipl_gradient_dir const& A)
00043            : vipl_filter_2d<ImgIn,ImgOut,DataIn,DataOut,PixelItr>(A),
00044              shift_(A.shift()), scale_(A.scale()) {}
00045   inline ~vipl_gradient_dir() {}
00046 
00047   // -+-+- required method for filters: -+-+-
00048   bool section_applyop();
00049 };
00050 
00051 #ifdef INSTANTIATE_TEMPLATES
00052 #include "vipl_gradient_dir.txx"
00053 #endif
00054 
00055 #endif // vipl_gradient_dir_h_