43 #ifndef __OPENCV_CORE_EIGEN_HPP__
44 #define __OPENCV_CORE_EIGEN_HPP__
53 template<
typename _Tp,
int _rows,
int _cols,
int _options,
int _maxRows,
int _maxCols>
54 void eigen2cv(
const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
Mat&
dst )
56 if( !(src.Flags & Eigen::RowMajorBit) )
59 (
void*)src.data(), src.stride()*
sizeof(_Tp));
65 (
void*)src.data(), src.stride()*
sizeof(_Tp));
70 template<
typename _Tp,
int _rows,
int _cols,
int _options,
int _maxRows,
int _maxCols>
72 Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>&
dst )
75 if( !(dst.Flags & Eigen::RowMajorBit) )
78 dst.data(), (size_t)(dst.stride()*
sizeof(_Tp)));
79 if( src.
type() == _dst.type() )
87 Mat(src.
t()).convertTo(_dst, _dst.type());
93 dst.data(), (size_t)(dst.stride()*
sizeof(_Tp)));
99 template<
typename _Tp>
101 Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>&
dst )
104 if( !(dst.Flags & Eigen::RowMajorBit) )
107 dst.data(), (size_t)(dst.stride()*
sizeof(_Tp)));
108 if( src.
type() == _dst.type() )
116 Mat(src.
t()).convertTo(_dst, _dst.type());
122 dst.data(), (size_t)(dst.stride()*
sizeof(_Tp)));
129 template<
typename _Tp>
131 Eigen::Matrix<_Tp, Eigen::Dynamic, 1>&
dst )
134 dst.resize(src.
rows);
136 if( !(dst.Flags & Eigen::RowMajorBit) )
139 dst.data(), (size_t)(dst.stride()*
sizeof(_Tp)));
140 if( src.
type() == _dst.type() )
143 Mat(src.
t()).convertTo(_dst, _dst.type());
149 dst.data(), (size_t)(dst.stride()*
sizeof(_Tp)));
156 template<
typename _Tp>
158 Eigen::Matrix<_Tp, 1, Eigen::Dynamic>&
dst )
161 dst.resize(src.
cols);
162 if( !(dst.Flags & Eigen::RowMajorBit) )
165 dst.data(), (size_t)(dst.stride()*
sizeof(_Tp)));
166 if( src.
type() == _dst.type() )
169 Mat(src.
t()).convertTo(_dst, _dst.type());
175 dst.data(), (size_t)(dst.stride()*
sizeof(_Tp)));