Text course of OpenCV configuration method under vs2015


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/


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)




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

(check inherit from parent or project default settings)


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)


Add an entry in the environment variable path.

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


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
  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.