In this article, download software's, configure visual studio for opencv and build hello world opencv app using c++ in visual studio 2017.
First download required softwares:
a) Download latest from opencv 3.3
b) Install visual studio 2017 with c++ packages
Then, lets setup global environment variables for opencv build:
a) Goto My computer -> Right click -> Properties
b) Click "Advance System Settings" -> click "Environment Variables"
c) Click "New" from System variables grid
d) Enter "Variable name:" = OPENCV_DIR & "Variable value:" = C:\Program Files\opencv\build\ or opencv build path
e) Select Variable 'Path' from System variables grid
f) Edit append ";%OPENCV_DIR%\x64\vc14\bin" ; is delimiter to earlier paths
Last, we should configure Visual studio 2017 opencv project properties:
a) create a new c++ console project in visual studio 2017
b) click project properties
c) Goto -> Configuration Properties->C/C++->General->Additional Include Directories-> set "C:\Program Files\opencv\build\include"
Woot woot , thats it, you are all set to develop amazing image processing app.
Here is the Test code:
#include "stdafx.h"
#include opencv2/core/core.hpp
#include opencv2/highgui/highgui.hpp
#include iostream
using namespace cv;
using namespace std;
int main()
{
Mat image;
image = imread("c:\\mahesh\\pics 110.jpg", IMREAD_COLOR); // Read the file
namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}