编译/链接OpenCV Matlab源文件时出错 [英] Error while compiling/linking OpenCV Matlab source files

查看:1336
本文介绍了编译/链接OpenCV Matlab源文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

成功编译95%的OpenCV后,出现错误

After successfully compiling 95% of OpenCV, I get the error

(...)
[ 95%] Built target opencv_videostab
[ 95%] Generating Matlab source files
[ 95%] Built target opencv_matlab_sources
[ 95%] Compiling Matlab source files. This could take a while...
CMake Error at compile.cmake:47 (message):
  Failed to compile logPolar: /usr/bin/ld: cannot find -lopencv_core

  /usr/bin/ld: cannot find -lopencv_imgproc

  /usr/bin/ld: cannot find -lopencv_ml

  /usr/bin/ld: cannot find -lopencv_highgui

  /usr/bin/ld: cannot find -lopencv_objdetect

  /usr/bin/ld: cannot find -lopencv_flann

  /usr/bin/ld: cannot find -lopencv_features2d

  /usr/bin/ld: cannot find -lopencv_photo

  /usr/bin/ld: cannot find -lopencv_video

  /usr/bin/ld: cannot find -lopencv_videostab

  /usr/bin/ld: cannot find -lopencv_calib3d

  /usr/bin/ld: cannot find -lopencv_stitching

  /usr/bin/ld: cannot find -lopencv_superres

  /usr/bin/ld: cannot find -lopencv_nonfree

  collect2: ld returned 1 exit status



      mex: link of ' "logPolar.mexa64"' failed.





make[2]: *** [modules/matlab/compile.proxy] Error 1
make[1]: *** [modules/matlab/CMakeFiles/opencv_matlab.dir/all] Error 2
make: *** [all] Error 2

这让我困惑,因为据我所知,所有这些都应该在编译过程早期编译。使用的cmake命令是

This confuses me, because as far as I understand all these should have been compiled earlier in the build process. The cmake command used was

cmake -D MATLAB_ROOT_DIR=/usr/lib/matlab2012a/ -D CMAKE_INSTALL_PREFIX=/home/user ..


推荐答案

我有同样的问题,为什么它还没有包括在官方发行版。我的解决方案如下:

I had the same problem, I guess there's a reason why it's not yet included in the official distribution. My solution was the following:


  1. 编译OpenCV而不使用Matlab模块,对于我来说这只是没有指定Matlab的位置,因为它wasn'

  2. 安装OpenCV(make install),这将安装必要的库。
  3. / li>
  4. 再次运行cmake,这次包括Matlab选项,运行make。

  5. 此时,编译一些生成的错误Mex源文件。我只是删除了无法编译的文件。这些是我不得不删除的文件:

  1. Compile OpenCV without the Matlab module, for me this ẃas simply not specifying where Matlab was located since it wasn't in a standard location, but it should be possible by setting a variable in cmake or modifying the CMake configuration files.
  2. Install OpenCV (make install), this will install the necessary libraries.
  3. Run cmake again, this time including the Matlab option, run make.
  4. At this point, a bunch of errors occur while compiling some of the generated Mex source files. I simply removed the files that would not compile. These are the files I had to remove:




createAlignMTB.cpp
createCalibrateDebevec.cpp
createCalibrateRobertson.cpp
createLineSegmentDetector.cpp
createMergeDebevec.cpp
createMergeMertens.cpp
createMergeRobertson.cpp
createTonemap.cpp
createTonemapDrago.cpp
createTonemapDurand.cpp
createTonemapMantiuk.cpp
createTonemapReinhard.cpp
findCirclesGrid.cpp


我不需要它们,希望你也是这样,如果你需要解决错误。 (源文件在生成后似乎无法重新生成,因此可以安全修改)

I did not need any of them, hopefully the same is true for you, if you do you'll need to resolve the errors. (the source files don't seem to be regenerated once generated so may be safely modified)


  1. make install!


  2. 利润!

这篇关于编译/链接OpenCV Matlab源文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆