Till today I was working with OpenCV on ubuntu platform. But we should also have knowledge about using the OpenCV libraries with Visual studio in Windows. Here I will be explaining how to integrate OpenCV with Windows 32-bit and 64-bit versions.
Download OpenCV from here: http://opencv.org/downloads.html
Double click on the downloaded exe file and when it is is being extracted select the folder name as “opencv” and extract it in your C drive.
Now we need to add the path of the extracted libraries to Environment variables.
Go to “Control Panel” >> “System and Security” >> “System” and click on “advanced system properties” and a window will appear(the one inside the red rectangle):
Now click on the “environment variable”, in the “system variables” select “Path” and edit it by adding these lines to it:
Assuming that you are using Visual Studio 2010
You are basically adding path to bin in the environment variables, so make sure the path is correct and make appropriate changes if necessary.
Click on “OK” in every window that has been opened to make the changes.
Open Visual studio 2010 and create a new visual c++ win32 console application project. Name it something and create it.
Now in that select the “View” menu and click on “Property Manager”.
Only for 64-Bit version users.
And in that Select the new platform as “X64”, click on “ok” and close the configuration manager.
Here we are adding path to include folders,make sure the path is correct as per your computer.
Select the “Configuration Properties” >> “C/C++” >> “Preprocessor” and in that select the “Preprocessor definition”,edit it by adding this to it :
64-Bit version users add this line to it:
32-Bit version users add this line to it:
Make sure the path to lib is correct as per your settings.
Note: In …..246.lib,246 is the version of opencv,for me its OpenCV-2.4.6 ,So make appropriate changes according to the version you have downloaded.
Click on “apply” and “ok”
Now in the code DELETE everything and copy the test code from here: https://github.com/abhi-kumar/OPENCV_MISC/blob/master/tracker.cpp
Note:on the top of the code add this line: #include “stdafx.h”
Get the details of the code from : https://abhishek4273.wordpress.com/2014/07/05/track-the-region-of-interest/
So, now you have integrated OpenCV with Windows Visual Studio