简体   繁体   English

如何为MinGW项目设置OpenCV?

[英]How do I set up OpenCV for MinGW project?

I regularly use Code::Blocks and MinGW for my C/C++ projects. 我经常在我的C / C ++项目中使用Code :: Blocks和MinGW。 I would like to be able to use OpenCV, since it has a nice library for computer vision projects. 我希望能够使用OpenCV,因为它有一个很好的计算机视觉项目库。 They have dropped support for MinGW. 他们放弃了对MinGW的支持。 I have heard you can build it on your own somehow, but I have no experience doing this with 3rd party libraries. 我听说您可以自行构建它,但是我没有使用第三方库进行此操作的经验。 Can someone explain how to build it in a simple way for MinGW? 有人可以解释如何以简单的方式为MinGW构建它吗?

There is, or at least there was at least until 2.4.6, precompiled version of opencv that works out of the box with mingw as long as you use the dw2(standard) version of mingw. 只要您使用mingw的dw2(标准)版本,就有至少在2.4.6之前存在预编译版本的opencv与mingw一起使用。

since i needed sjlj support i had to build my own version of openCV 2.4.6 I did he following - i am pretty sure it will work for the current openCV version as well 因为我需要sjlj支持,所以我必须构建自己的openCV 2.4.6版本,我也遵循了他的原则-我很确定它也适用于当前的openCV版本

  1. Setup your preferred Mingw Environment - i would strongly recommend to use gcc 4.5 or newer 设置您首选的Mingw环境-我强烈建议使用gcc 4.5或更高版本
  2. Intstall Msys 安装Msys
  3. Intall Cmake - you can get a binary package Intall Cmake-您可以获得二进制包
  4. Start the Cmake GUI 启动Cmake GUI
  5. Select the openCV source folder 选择openCV源文件夹
  6. Click Configure and select MSYS-Makfiles 单击“ 配置”,然后选择“ MSYS-Makfiles”
  7. Errors in the first run of Configure might be resolved if you run Configure again 如果再次运行Configure,则可能会解决首次运行Configure中的错误
  8. Click Generate 点击生成
  9. use MSYS make to run the generated makefile 使用MSYS make运行生成的makefile
  10. Copy all desired libraries and include files to your mingw-installation or your project 复制所有需要的库并将包含的文件复制到您的mingw安装程序或项目中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM