diff --git a/CMakeLists.txt b/CMakeLists.txt index 50e1bbdd8f..9ca5dd9de1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,6 +280,7 @@ if(APPLE) endif() set(WITH_TBB OFF CACHE BOOL "Include TBB support") +set(WITH_EIGEN2 OFF CACHE BOOL "Include Eigen2 support") # =================================================== # Macros that checks if module have been installed. @@ -347,7 +348,7 @@ if(UNIX) if(WITH_PVAPI) find_path(PVAPI_INCLUDE_PATH "PvApi.h" - PATHS "/usr/include" "/usr/local/include" + PATHS "/usr/local/include" "/usr/include" DOC "The path to PvAPI header") if(PVAPI_INCLUDE_PATH) set(HAVE_PVAPI 1) @@ -557,8 +558,8 @@ if (WITH_TBB) endif() if (APPLE) set(TBB_DEFAULT_INCLUDE_DIRS - "/usr/include" - "/usr/local/include") + "/usr/local/include" + "/usr/include") endif() if (WIN32) set(TBB_DEFAULT_INCLUDE_DIRS @@ -624,6 +625,19 @@ if (WITH_TBB) endif() endif() + +############################## Eigen2 ############################## + +if(WITH_EIGEN2) + find_path(EIGEN2_INCLUDE_PATH "Eigen/Core" + PATHS "/usr/local/include/eigen2" "/opt/include/eigen2" "/usr/include/eigen2" + DOC "The path to Eigen2 headers") + if(EIGEN2_INCLUDE_PATH) + include_directories(${EIGEN2_INCLUDE_PATH}) + set(HAVE_EIGEN2 1) + endif() +endif() + ############################### IPP ################################ set(IPP_FOUND) set(OPENCV_LOADER_PATH) @@ -1251,6 +1265,12 @@ else() message(STATUS " Use TBB: NO") endif() +if(HAVE_EIGEN2) +message(STATUS " Use Eigen2: YES") +else() +message(STATUS " Use Eigen2: NO") +endif() + message(STATUS "") message(STATUS " Documentation: ") diff --git a/cvconfig.h.cmake b/cvconfig.h.cmake index f77d5fec7e..6443622790 100644 --- a/cvconfig.h.cmake +++ b/cvconfig.h.cmake @@ -155,4 +155,7 @@ #cmakedefine WORDS_BIGENDIAN /* Intel Threading Building Blocks */ -#cmakedefine HAVE_TBB \ No newline at end of file +#cmakedefine HAVE_TBB + +/* Eigen2 Matrix & Linear Algebra Library */ +#cmakedefine HAVE_EIGEN2 diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp index a51e3c73ab..5e39e8305d 100644 --- a/modules/core/include/opencv2/core/core.hpp +++ b/modules/core/include/opencv2/core/core.hpp @@ -566,7 +566,7 @@ public: static Matx eye(); static Matx diag(const Vec<_Tp, MIN(m,n)>& d); static Matx randu(_Tp a, _Tp b); - static Matx randn(_Tp m, _Tp sigma); + static Matx randn(_Tp a, _Tp b); //! convertion to another data type template operator Matx() const; @@ -575,7 +575,7 @@ public: template Matx<_Tp, m1, n1> reshape() const; //! extract part of the matrix - template Matx<_Tp, m1, n1> minor(int i, int j) const; + template Matx<_Tp, m1, n1> get_minor(int i, int j) const; //! extract the matrix row Matx<_Tp, 1, n> row(int i) const; diff --git a/modules/core/include/opencv2/core/internal.hpp b/modules/core/include/opencv2/core/internal.hpp index 5f4d16477c..244dbc3fcf 100644 --- a/modules/core/include/opencv2/core/internal.hpp +++ b/modules/core/include/opencv2/core/internal.hpp @@ -134,6 +134,10 @@ CV_INLINE IppiSize ippiSize(int width, int height) #endif #endif +#ifdef HAVE_EIGEN2 + #include "opencv2/core/eigen.hpp" +#endif + #ifdef __cplusplus #ifdef HAVE_TBB diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index e7627564f6..22651db45b 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -734,7 +734,7 @@ Matx<_Tp, m1, n1> Matx<_Tp, m, n>::reshape() const template template inline -Matx<_Tp, m1, n1> Matx<_Tp, m, n>::minor(int i, int j) const +Matx<_Tp, m1, n1> Matx<_Tp, m, n>::get_minor(int i, int j) const { CV_DbgAssert(0 <= i && i+m1 <= m && 0 <= j && j+n1 <= n); Matx<_Tp, m1, n1> s;