Since I'm new to the Opencv i followed a tutorials to install.
- First I downloaded Opencv 3.1.0 from http://opencv.org.
- Then I extract in to C drive.
- And set environment variables. Add a new variable OPENCV_DIR and set value to C:\opencv\build\x64\vc14 and set the path to %OPENCV_DIR%\bin.
- Then I open new project in C++ Console Application and set properties,
Release >
C/C++ General > Additional Include Directories --> $(OPENCV_DIR)....\include.
Linker General > Additional Include Directories -->$(OPENCV_DIR)\lib
Linker Input> Additional Dependancies-->opencv_world310.lib
Debug >
C/C++ General > Additional Include Directories --> $(OPENCV_DIR)....\include.
Linker General > Additional Include Directories -->$(OPENCV_DIR)\lib
Linker Input> Additional Dependancies-->opencv_world310d.lib
Then I used a test code..
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, const char** argv)
{
Mat img = imread("C:\\Users\\Nisal\\Desktop\\b.JPG", CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file "MyPic.JPG" and store it in 'img'
if (img.empty()) //check whether the image is loaded or not
{
cout << "Error : Image cannot be loaded..!!" << endl;
//system("pause"); //wait for a key press
return -1;
}
namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow"
imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window
waitKey(0); //wait infinite time for a keypress
destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"
return 0;
}
there are no build errors. When i run, a windows console opens and close suddenly, the picture i want to display is not displaying. Output is like this..says some missing PDB files. So what should I do to make this correct.