R71
R71

Reputation: 4523

OpenCV installation in windows

I am trying to install opencv in windows. The manual (secn 1.4) says "choose a build [e.g. vs2010, win32] and download", but there is only the full executable file available (for 2.4.2). So I downloaded that file, which then expanded into several directories. However, this directory list does not match what is shown under item 7 of the section - mainly the "bin" directory is missing. So I guess something more has to be done besides just clicking on the executable.

Under "build" dir, I see x86/vc10/bin (I am guessing that vc10 stands for visual c++ 2010). But how do I install these and link visual studio 2010 with it? The manual only says to setup "OPENCV_DIR" variable which should have "bin" under it, but I dont have that.

This seems like a real problem any new user would face with opencv installation. Any correct instructions and link available on how to install for windows+visual studio 2010?

Updates: Full solution posted below.

Upvotes: 3

Views: 9850

Answers (2)

R71
R71

Reputation: 4523

After much experimentation, I have got opencv-2.4.2(win-exe) + vstudio2010-express working together. Thanks to Abid, for providing a helpful link, an additional helpful link is http://blog.hcilab.org/bastian/2012/06/installing-opencv-2-4-windows-7-visual-studio

Here is the full list of steps:

  • set system var OPENCV_DIR = install_dir\build
  • set system var TBBROOT = tbb_install_dir
  • path += ;%OPENCV_DIR%\x86\vc10\bin;%TBBROOT%\bin\ia32\vc10
  • create empty project: File->New->Project->Win32ConsoleApp
  • add the following items in project->Properties:
  • download image-display test file from above site, save it in the project dir. But the Test.cpp in that page requires more inputs, so it does not work easily. Instead, use the code from http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html#display-image
  • Properties->ConfigProps->Debugging->CommandArgs: mention file name to be loaded
  • Tools->Option->Debugging->Symbol->MS-Server=yes (this removes most of the "PDB not found" errors)
  • Tools->Settings->ExpertSettings=on (this also removes some errors)
  • copy tbb_debug.dll and tbb.dll from TBBROOT\bin\ia32\vc10 to the project dir (I dont know why these are not automatically picked up with the settings done above)
  • Ctrl+F5 to run (start without debugging)

Upvotes: 3

Nikson Kanti Paul
Nikson Kanti Paul

Reputation: 3440

i think your installation is OK. just need to configure with VS

  1. in Project Properties > C/C++ > Add Additional Include Directory: C:\opencv\build\include;C:\opencv\build\include\opencv

  2. C/C++ > Linker > Input add Additional Dependencies : C:\opencv\build\x86\vc9\lib\opencv_core231.lib
    C:\opencv\build\x86\vc9\lib\opencv_flann231.lib
    C:\opencv\build\x86\vc9\lib\opencv_highgui231.lib
    C:\opencv\build\x86\vc9\lib\opencv_imgproc231.lib

    and more if needed

  3. add OPENCV_DIR environment variable with value C:\opencv\build\x86\vc10\bin

more detail follow this OpenCV 2.1 with MS Visual Studio

Upvotes: 1

Related Questions