Commit 017a38a5 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #10108 from mshabunin:fix-eigen-stride

parents b45403ed f50ec229
......@@ -65,13 +65,13 @@ void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCo
if( !(src.Flags & Eigen::RowMajorBit) )
{
Mat _src(src.cols(), src.rows(), traits::Type<_Tp>::value,
(void*)src.data(), src.stride()*sizeof(_Tp));
(void*)src.data(), src.outerStride()*sizeof(_Tp));
transpose(_src, dst);
}
else
{
Mat _src(src.rows(), src.cols(), traits::Type<_Tp>::value,
(void*)src.data(), src.stride()*sizeof(_Tp));
(void*)src.data(), src.outerStride()*sizeof(_Tp));
_src.copyTo(dst);
}
}
......@@ -99,7 +99,7 @@ void cv2eigen( const Mat& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
if( src.type() == _dst.type() )
transpose(src, _dst);
else if( src.cols == src.rows )
......@@ -113,7 +113,7 @@ void cv2eigen( const Mat& src,
else
{
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.convertTo(_dst, _dst.type());
}
}
......@@ -126,13 +126,13 @@ void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(_cols, _rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
transpose(src, _dst);
}
else
{
const Mat _dst(_rows, _cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
Mat(src).copyTo(_dst);
}
}
......@@ -145,7 +145,7 @@ void cv2eigen( const Mat& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
if( src.type() == _dst.type() )
transpose(src, _dst);
else if( src.cols == src.rows )
......@@ -159,7 +159,7 @@ void cv2eigen( const Mat& src,
else
{
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.convertTo(_dst, _dst.type());
}
}
......@@ -173,13 +173,13 @@ void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(_cols, _rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
transpose(src, _dst);
}
else
{
const Mat _dst(_rows, _cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
Mat(src).copyTo(_dst);
}
}
......@@ -194,7 +194,7 @@ void cv2eigen( const Mat& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
if( src.type() == _dst.type() )
transpose(src, _dst);
else
......@@ -203,7 +203,7 @@ void cv2eigen( const Mat& src,
else
{
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.convertTo(_dst, _dst.type());
}
}
......@@ -218,13 +218,13 @@ void cv2eigen( const Matx<_Tp, _rows, 1>& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(1, _rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
transpose(src, _dst);
}
else
{
const Mat _dst(_rows, 1, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.copyTo(_dst);
}
}
......@@ -239,7 +239,7 @@ void cv2eigen( const Mat& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
if( src.type() == _dst.type() )
transpose(src, _dst);
else
......@@ -248,7 +248,7 @@ void cv2eigen( const Mat& src,
else
{
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.convertTo(_dst, _dst.type());
}
}
......@@ -262,13 +262,13 @@ void cv2eigen( const Matx<_Tp, 1, _cols>& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(_cols, 1, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
transpose(src, _dst);
}
else
{
const Mat _dst(1, _cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
Mat(src).copyTo(_dst);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment