文章作者:Tyan
博客:noahsnail.com ?|? CSDN ?|? 簡書
在Mac中安裝OpenCV3時,如果需要安裝--with-contrib
,則會報錯,OpenCV 3的安裝命令為:
brew install opencv3 --with-contrib
錯誤信息如下:
In file included from /usr/local/include/eigen3/Eigen/Core:422:
In file included from /usr/local/include/eigen3/Eigen/src/Core/ArrayBase.h:93:
/usr/local/include/eigen3/Eigen/src/Core/../plugins/ArrayCwiseUnaryOps.h:489:14: error: unknown type name 'LgammaReturnType'; did you mean 'DigammaReturnType'?
inline const LgammaReturnType
^
/usr/local/include/eigen3/Eigen/src/Core/../plugins/ArrayCwiseUnaryOps.h:471:74: note: 'DigammaReturnType' declared here
typedef CwiseUnaryOp<internal::scalar_digamma_op<Scalar>, const Derived> DigammaReturnType;
^
4 errors generated.
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make: *** [all] Error 2
這里主要是OpenCV 3 contrib支持eigen-3.2.10但不支持eigen-3.3.0,因此需要安裝eigen-3.2.10,安裝命令如下:
# 安裝
brew install homebrew/versions/eigen32
# link
brew link --force eigen32
然后再安裝OpenCV 3就可以了,當然如果不需要contrib選項,安裝是沒問題的。