VS2015 and Opencv4.1 configuration (win10 system)

  • Download and install Opencv

Download: https://opencv.org/releases/

opencv installation package is actually a self-extracting program, you do not need to create a new folder during installation, because he himself is the root of opencv.

  • Configuration Opencv

  1. New in VS [a] Win32 console application and check the empty project. Or configured directly on an existing project.
  2. In the menu bar, click View - [another window] - [property manager] - [Expand Debug | X64] - double-click [Microsoft.Cpp.x64.user]
  3. VC ++ directory [] - [] Add the directory that contains the following two directories :( specific path depends on where you put opencv in my opencv on the D drive)

D:\opencv\build\include

D:\opencv\build\include\opencv2

    4. VC ++ [directory] - [Library Catalog] Add the following directories:

D:\opencv\build\x64\vc14\lib

    The [Linker] - [Input] - [] add additional dependency both of the following:

opencv_world410d.lib (Debug version)

opencv_world410.lib (Release version)

    6. [computer] - Right-click [Properties] - [Advanced System Settings] - [Advanced] - [Environment Variables] - double-click [path] - opencv add the bin folder path. Such as: D: \ opencv \ build \ x64 \ vc14 \ bin

  • Opencv test whether the configuration

Create a cpp file in the source file, reads and displays a picture:

//////////////////////////////////
//opencv4.1.0
//////////////////////////////////

#include <opencv2/opencv.hpp>

using namespace cv;

int main() {

	Mat src = imread("1.png"); //该图片需在工程目录下

	imshow("原图", src);

	waitKey(0);

	return 0;
}
  • Precautions

  1. This configuration can once and for all, on the computer after the new construction will inherit this configuration. If you click on the menu bar of the [Project] - [Project Properties] to your configuration valid only for the current project, the new project will not inherit the configuration.
  2. At least one HighGUI window is created when, waitKey () function will not work. If imshow function annotation, then after running the flash off.

 

 

 

Guess you like

Origin blog.csdn.net/jgj123321/article/details/94636112