+// Matx case
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols>
+void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
+ Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
+{
+ if( !(dst.Flags & Eigen::RowMajorBit) )
+ {
+ Mat _dst(_cols, _rows, DataType<_Tp>::type,
+ dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+ transpose(src, _dst);
+ CV_DbgAssert(_dst.data == (uchar*)dst.data());
+ }
+ else
+ {
+ Mat _dst(_rows, _cols, DataType<_Tp>::type,
+ dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+ Mat(src).copyTo(_dst);
+ CV_DbgAssert(_dst.data == (uchar*)dst.data());
+ }
+}
+