Text course of OpenCV configuration method under vs2015

Time:2020-10-27

This example for you to share the Android Jiugongge picture display of the specific code, for your reference, the specific content is as follows

Please replace the pathname in the following configuration process with the actual pathname.

Opencv website: http://opencv.org/

GitHub:https://github.com/Itseez/opencv

Configuration process

Create a new C + + project.

Open project properties.

Change the platform.

Add the include directory in VC + + Directory – include directory.

(check inherit from parent or project default settings)

D:\OpenCV\build\include

D:\OpenCV\build\include\opencv

D:\OpenCV\build\include\opencv2

Add the Library Directory in VC + + directory Library Directory.

(check inherit from parent or project default settings)

D:\OpenCV\build\x64\vc14\lib

Add additional dependencies in linker input attach dependencies.

(the additional dependencies added are. Lib files in the Library Directory added in the previous step)

(check inherit from parent or project default settings)


opencv_world310.lib
opencv_world310d.lib

Add an entry in the environment variable path.

(here is the directory of the DLL. DLL file)

D:\OpenCV\build\x64\vc14\bin

Add test code and test files.

(program source online)

//#include "stdafx.h"
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main(int argc, char *argv[]) {
  const char* imagename = "lena.jpg";
  //Read image from file
  Mat img = imread(imagename);
  //If the reading of the image fails
  if (img.empty()) {
    fprintf(stderr, "Can not load image %s\n", imagename);
    return -1;
  }
  //Display image
  imshow("image", img);
  //This function waits for a key to be pressed and returns by pressing any key on the keyboard
  waitKey();
  return 0;
}

Project running results.

The above is the whole content of this article, I hope to help you in your study, and I hope you can support developeppaer more.