win7 Visual Studio 2010 配置opencv 2.4.5 开发环境

I

Note

 

To use the OpenCV library you have two options: Installation by Using the Pre-built Libraries or Installation by Making Your Own Libraries from the Source Files. While the first one is easier to complete, it only works if you are coding with the latest Microsoft Visual Studio IDE and doesn’t take advantage of the most advanced technologies we integrate into our library.

IInstallation by Making Your Own Libraries from theSource Files

step 1:安装必要的软件和第三方库

step 2:上面三项内容已足以开始opencv的编译安装,但是还有一些第三方的工具,推荐安装。

  • Download the Python libraries(http://www.python.org/getit/) and install it with the default options
  • For the Intel © Threading Building Blocks (TBB) download the source files and extract it inside a directory on your system. For example let there be D:/OpenCV/dep
  • For the CUDA you need again two modules: the latest CUDA Toolkit and the CUDA Tools SDK. Download and install both of them with a complete option by using the 32 or 64 bit setups according to your OS.
  • In case of the Qt framework you need to build yourself the binary files (unless you use the Microsoft Visual Studio 2008 with 32 bit compiler). To do this go to the Qt Downloads page. Download the source files (not the installers!!!).Extract it into a nice and short named directory like D:/OpenCV/dep/qt/ . Then you need to build it. Start up a Visual Studio Command Prompt (2010) by using the start menu search (or navigate through the start menu All Programs ‣ Microsoft Visual Studio 2010 ‣ Visual Studio Tools ‣ Visual Studio Command Prompt (2010)).

    Now navigate to the extracted folder and enter inside it by using this console window. You should have a folder containing files like InstallMake and so on. Use the dir command to list files inside your current directory. Once arrived at this directory enter the following command:

    configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools
                  -no-qt3support -no-multimedia -no-ltcg
    

    Completing this will take around 10-20 minutes. Then enter the next command that will take a lot longer (can easily take even more than a full hour):

    nmake
    

    After this set the Qt enviroment variables using the following command on Windows 7:

    setx -m QTDIR D:/OpenCV/dep/qt/qt-everywhere-opensource-src-4.7.3
    

    Also, add the built binary files path to the system path by using the Path Editor. In our case this is D:/OpenCV/dep/qt/qt-everywhere-opensource-src-4.7.3/bin.

    Note

     

    If you plan on doing Qt application development you can also install at this point the Qt Visual Studio Add-in. After this you can make and build Qt applications without using theQt Creator. Everything is nicely integrated into Visual Studio.

如果之前已经安装好qt,则只需要在cmake过程指定好路径即可。

Step 3:使用CMake进行配置

在cmake中第一次configure之后,在WITH中选定一些自己需要的配置。如下:

请自己根据情况选择。
  • 在Ungrouped Entries组中,手工指定CMake没有检测到,而你又需要使用的环境变量。比如,我需要TBB,就设定TBB_INCLUDE_DIRS为D:/Develop/TBB/tbb41_20121003oss/include等等。在这一步中,将上述第三方库诸如python,qt等的环境变量在Ungrouped Entries中设定好。
  • 浏览其它选项,选择需要的内容,特别地,在ENABLE中的ENABLE_SOLUTION_FOLDERS必须确定选上
  • 设定完成后,点击左下方Generate,生成vs2010的工程文件。
step 4: 在vs中打开Opencv工程文件,编译debug和release两个版本。

Step 5:添加OpenCV路径至PATH

打开<opencv Build目录>\install\bin\Debug\contours2.exe(或者其他程序),如果成功运行,则表示OpenCV安装成功!



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值