Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
f605898b
Commit
f605898b
authored
Dec 16, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix eigen2cv() - don't change fixed type of 'dst'
parent
4f9c1da8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
eigen.hpp
modules/core/include/opencv2/core/eigen.hpp
+1
-1
test_mat.cpp
modules/core/test/test_mat.cpp
+24
-0
No files found.
modules/core/include/opencv2/core/eigen.hpp
View file @
f605898b
...
...
@@ -60,7 +60,7 @@ namespace cv
//! @{
template
<
typename
_Tp
,
int
_rows
,
int
_cols
,
int
_options
,
int
_maxRows
,
int
_maxCols
>
static
inline
void
eigen2cv
(
const
Eigen
::
Matrix
<
_Tp
,
_rows
,
_cols
,
_options
,
_maxRows
,
_maxCols
>&
src
,
Mat
&
dst
)
void
eigen2cv
(
const
Eigen
::
Matrix
<
_Tp
,
_rows
,
_cols
,
_options
,
_maxRows
,
_maxCols
>&
src
,
OutputArray
dst
)
{
if
(
!
(
src
.
Flags
&
Eigen
::
RowMajorBit
)
)
{
...
...
modules/core/test/test_mat.cpp
View file @
f605898b
...
...
@@ -3,6 +3,12 @@
// of this distribution and at http://opencv.org/license.html.
#include "test_precomp.hpp"
#ifdef HAVE_EIGEN
#include <Eigen/Core>
#include <Eigen/Dense>
#include "opencv2/core/eigen.hpp"
#endif
namespace
opencv_test
{
namespace
{
class
Core_ReduceTest
:
public
cvtest
::
BaseTest
...
...
@@ -1972,4 +1978,22 @@ TEST(Core_Vectors, issue_13078_workaround)
ASSERT_EQ
(
7
,
ints
[
3
]);
}
#ifdef HAVE_EIGEN
TEST
(
Core_Eigen
,
eigen2cv_check_Mat_type
)
{
Mat
A
(
4
,
4
,
CV_32FC1
,
Scalar
::
all
(
0
));
Eigen
::
MatrixXf
eigen_A
;
cv2eigen
(
A
,
eigen_A
);
Mat_
<
float
>
f_mat
;
EXPECT_NO_THROW
(
eigen2cv
(
eigen_A
,
f_mat
));
EXPECT_EQ
(
CV_32FC1
,
f_mat
.
type
());
Mat_
<
double
>
d_mat
;
EXPECT_ANY_THROW
(
eigen2cv
(
eigen_A
,
d_mat
));
//EXPECT_EQ(CV_64FC1, d_mat.type());
}
#endif // HAVE_EIGEN
}}
// namespace
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment