[Windows] Visual Studio + OpenCV

將OpenCV完美建置於Visual Studio上
Setting Up OpenCV 3.1 in Visual Studio 2015 (Youtube Video)

To make OpenCV work correctly with Visual Studio 2015, you should download OpenCV which version is newer than 3.1

You can use the testing code below to confirm whether it works
Remember to add

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

at the beginning of the source code

using namespace std;
using namespace cv;

int main(int argc, char** argv)
 argv[1] = "D:\\picure.jpg";
 Mat image;
 image = imread(argv[1], CV_LOAD_IMAGE_COLOR);

 if (!image.data)
  cout << "No Image" << std::endl;
  return -1;

 namedWindow("Display", CV_WINDOW_NORMAL);
 imshow("Display", image);

 return 0;