ubuntu16.04下安装opencv-3.1.0及其扩展模块opencv_contrib参考我的博客

https://www.cnblogs.com/feifanrensheng/p/9042813.html

在安装过程中会发生报错

报错1:提示找不到hdf5.h文件

ubuntu16.04下安装opencv-3.1.0及其扩展模块opencv_contrib报错及解决方法

解决方案:

I attached makefile output for this error. It seems that for python2 and python3 modules there are no include paths for HDF5, i. e. dirty hardcoding

find_package(HDF5)
include_directories(${HDF5_INCLUDE_DIRS})

into modules/python/common.cmake solves the problem. I believe that it is not nice solution, that's why I don't attach pull request.

翻译过来就是python模块没有包含hdf5的头文件路径

所以我们要在opencv-3.1.0/modules/python/common.cmake文件中添加

find_package(HDF5)
include_directories(${HDF5_INCLUDE_DIRS})

报错2:提示opencv_contrib的tracking/include/opencv2/tracking/onlineMIL.hpp文件出错

提示宏命令#define  sign(s)  ((s > 0 ) ? 1 : ((s<0) ? -1 : 0)) 不合法,不思其解,我就把这句话注释掉
src/目录下onlineMIL.cpp包含了这个头文件,所以我要把所有的sign(s)给替换一下

    _q = ( _mu1 - _mu0 ) / 2;
    _s = sign( _mu1 - _mu0 );
   

改为

    _q = ( _mu1 - _mu0 ) / 2;
    //_s = sign( _mu1 - _mu0 );
    if (_q > 0 ) _s = 1;
    if (_q < 0 ) _s = -1;
    if (_q = 0 ) _s = 0;

其实是一样的效果,这样就可以编译通过了

相关文章:

  • 2021-05-18
  • 2022-01-22
  • 2021-05-28
  • 2021-12-20
  • 2021-06-10
  • 2021-06-12
  • 2021-10-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-08-22
  • 2022-02-09
  • 2022-01-23
相关资源
相似解决方案