From 74020a084bc3cdd98822f38ea808226df7aa292a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Sun, 31 May 2020 15:22:03 +0000 Subject: [PATCH] core: fix builds with eigen helper header --- modules/core/include/opencv2/core/eigen.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/core/include/opencv2/core/eigen.hpp b/modules/core/include/opencv2/core/eigen.hpp index 8c250efe4c..8afc06caa7 100644 --- a/modules/core/include/opencv2/core/eigen.hpp +++ b/modules/core/include/opencv2/core/eigen.hpp @@ -45,9 +45,14 @@ #ifndef OPENCV_CORE_EIGEN_HPP #define OPENCV_CORE_EIGEN_HPP +#ifndef EIGEN_WORLD_VERSION +#error "Wrong usage of OpenCV's Eigen utility header. Include Eigen's headers first. See https://github.com/opencv/opencv/issues/17366" +#endif + #include "opencv2/core.hpp" -#if EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3 +#if EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3 \ + && defined(CV_CXX11) && defined(CV_CXX_STD_ARRAY) #include #define OPENCV_EIGEN_TENSOR_SUPPORT #endif // EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3 @@ -157,7 +162,7 @@ Eigen::TensorMap> a_tensormap = cv2eige \endcode */ template static inline -Eigen::TensorMap> cv2eigen_tensormap(const cv::InputArray &src) +Eigen::TensorMap> cv2eigen_tensormap(InputArray src) { Mat mat = src.getMat(); CV_CheckTypeEQ(mat.type(), CV_MAKETYPE(traits::Type<_Tp>::value, mat.channels()), "");