Follow this link to skip to the main content

claraty::Transform_Op< T > Class Template Reference
[Algorithms]

#include <transform_op.h>

List of all members.

Public Member Functions

 Transform_Op ()
 Transform_Op (Matrix< T > _xform)
template<class TS, class TD>
void filter (Image< TS > src_image, Image< TD > &dest_image)
Matrix< T > get_xform ()
void set_xform (Matrix< T > xform)

Private Attributes

Matrix< T > _xform


Detailed Description

template<class T>
class claraty::Transform_Op< T >

Definition at line 37 of file transform_op.h.


Constructor & Destructor Documentation

template<class T>
claraty::Transform_Op< T >::Transform_Op (  )  [inline]

Definition at line 44 of file transform_op.h.

00044 {};

template<class T>
claraty::Transform_Op< T >::Transform_Op ( Matrix< T >  _xform  )  [inline]

Definition at line 45 of file transform_op.h.

References claraty::Transform_Op< T >::_xform.

00045                                  : _xform(xform) {
00046     if((_xform.get_num_of_cols() != 3) ||
00047        (_xform.get_num_of_rows() != 3))
00048       cout << "Transform_Op: matrix size is not 3x3" << endl;
00049   };


Member Function Documentation

template<class T>
template<class TS, class TD>
void claraty::Transform_Op< T >::filter ( Image< TS >  src_image,
Image< TD > &  dest_image 
)

Definition at line 69 of file transform_op.h.

References claraty::Transform_Op< T >::_xform, claraty::N_2D_Array< T >::get_num_of_cols(), claraty::N_2D_Array< T >::get_num_of_rows(), and claraty::N_2D_Array< T >::resize().

00070                                                     {
00071   
00072 
00073   cout << "transform: " << _xform << endl;
00074 
00075   dest_image.resize(src_image.get_num_of_rows(),
00076                     src_image.get_num_of_cols());
00077 
00078   Vector<T> v(3);
00079 
00080   for(int r=0; r<dest_image.get_num_of_rows(); r++) {
00081     for(int c=0; c<dest_image.get_num_of_cols(); c++) {
00082 
00083       v(0) = c;
00084       v(1) = r;
00085       v(2) = 1;
00086 
00087       //v = _xform*v.transpose();   // too slow...
00088 
00089       v(0) = _xform(0,0)*v(0) + _xform(0,1)*v(1) + _xform(0,2);
00090       v(1) = _xform(1,0)*v(0) + _xform(1,1)*v(1) + _xform(1,2);
00091 
00092       if((v(0) >= 0) && (v(0) < src_image.get_num_of_cols()) &&
00093          (v(1) >= 0) && (v(1) < src_image.get_num_of_rows())) {
00094         dest_image(r,c) = src_image(v(1), v(0));
00095       }
00096       else {
00097         dest_image(r,c) = 0;
00098       }
00099     }
00100   }
00101   
00102 
00103 }

Here is the call graph for this function:

template<class T>
Matrix<T> claraty::Transform_Op< T >::get_xform (  )  [inline]

Definition at line 54 of file transform_op.h.

References claraty::Transform_Op< T >::_xform.

00054                         { 
00055     return _xform;
00056   };

template<class T>
void claraty::Transform_Op< T >::set_xform ( Matrix< T >  xform  )  [inline]

Definition at line 57 of file transform_op.h.

References claraty::Transform_Op< T >::_xform.

00057                                   { 
00058     _xform = xform;
00059   };


Member Data Documentation


The documentation for this class was generated from the following file: