12 #ifndef mitkCvMatFromVnlMatrix_h
13 #define mitkCvMatFromVnlMatrix_h
17 #include <vnl/vnl_matrix.h>
20 #include "opencv2/core.hpp"
40 const vnl_matrix<T>* _VnlMatrix,
42 m_VnlMatrix(_VnlMatrix),
50 template <
class T_CvType,
class T_VnlType>
51 static void Cast(
const vnl_matrix<T_VnlType>& vnlMat, cv::Mat& cvMat )
54 cvMat = cv::Mat(vnlMat.rows(), vnlMat.cols(), cv::DataType<T_CvType>::type);
55 for(
unsigned int i=0; i<vnlMat.rows(); ++i)
57 for(
unsigned int j=0; j<vnlMat.cols(); ++j)
59 cvMat.at<T_CvType>(i,j) =
static_cast<T_CvType
>( vnlMat(i,j) );
71 Cast<T, T>( *m_VnlMatrix, *m_CvMat );
77 const vnl_matrix<T>* m_VnlMatrix;