12 #ifndef mitkVnlMatrixFromCvMat_h
13 #define mitkVnlMatrixFromCvMat_h
15 #include <vnl/vnl_matrix.h>
16 #include <opencv2/core.hpp>
35 const cv::Mat* _CvMat,
36 vnl_matrix<T>* _VnlMatrix):
38 m_VnlMatrix(_VnlMatrix)
46 template <
typename TCvMat,
typename TVnlMat>
47 void ToVnlMatrix( vnl_matrix<TVnlMat>& vnlMat,
const cv::Mat& mat )
49 vnlMat.set_size( mat.rows, mat.cols );
50 for(
int i=0; i<mat.rows; ++i)
51 for(
int j=0; j<mat.cols; ++j)
52 vnlMat(i,j) =
static_cast<TVnlMat
>( mat.at<TCvMat>(i,j) );
66 const cv::Mat* m_CvMat;
70 vnl_matrix<T>* m_VnlMatrix;