mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #25751 from simonkampe:fix-eigen-rowmajor
Add missing cv2eigen overload #25751 Fixes #16606 Add overloads to cv2eigen to handle eigen matrices of type Eigen::Matrix<Tp_, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -2259,6 +2259,27 @@ TEST(Core_Eigen, eigen2cv_check_Mat_type)
|
||||
EXPECT_ANY_THROW(eigen2cv(eigen_A, d_mat));
|
||||
//EXPECT_EQ(CV_64FC1, d_mat.type());
|
||||
}
|
||||
|
||||
TEST(Core_Eigen, cv2eigen_check_RowMajor)
|
||||
{
|
||||
Mat A(3, 2, CV_32FC1, Scalar::all(0));
|
||||
A.at<float>(0,0) = 1.0;
|
||||
A.at<float>(0,1) = 2.0;
|
||||
A.at<float>(1,0) = 3.0;
|
||||
A.at<float>(1,1) = 4.0;
|
||||
A.at<float>(2,0) = 5.0;
|
||||
A.at<float>(2,1) = 6.0;
|
||||
|
||||
Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> eigen_A;
|
||||
EXPECT_NO_THROW(cv2eigen(A, eigen_A));
|
||||
|
||||
ASSERT_EQ(1.0, eigen_A(0, 0));
|
||||
ASSERT_EQ(2.0, eigen_A(0, 1));
|
||||
ASSERT_EQ(3.0, eigen_A(1, 0));
|
||||
ASSERT_EQ(4.0, eigen_A(1, 1));
|
||||
ASSERT_EQ(5.0, eigen_A(2, 0));
|
||||
ASSERT_EQ(6.0, eigen_A(2, 1));
|
||||
}
|
||||
#endif // HAVE_EIGEN
|
||||
|
||||
#ifdef OPENCV_EIGEN_TENSOR_SUPPORT
|
||||
|
||||
Reference in New Issue
Block a user