野声

Hey, 野声!

谁有天大力气可以拎着自己飞呀
twitter
github

Configuring OpenCV 3.4.1 + Visual Studio on Windows 10

Installing OpenCV on Windows and setting up the environment is not difficult at all for VS. With just a few simple steps, you can use the OpenCV library in VS.

Download OpenCV:

Download link for OpenCV: https://opencv.org/releases.html

Choose the Windows version for download.

The downloaded file will be in .exe format. After running it, select the installation directory. I chose c:/opencv, and all the following tutorials will be related to this directory.

Configure system variables:

Open the system settings interface (you can type "system settings" in the search bar), and it will open the advanced system settings for you. Click on "Environment Variables" and create two new variables in the "Path" column of the system variables:

C:\opencv\build\bin
C:\opencv\build\x64\vc14\bin

Open VS and create a new project.

Go to Project Properties -> VC++ Directories -> Include Directories:

  • C:\opencv\build\include\
  • C:\opencv\build\include\opencv2
  • C:\opencv\build\include\opencv

Library Directories:

  • C:\opencv\build\x64\vc14\lib

Linker -> Input -> Additional Dependencies:

  • opencv_world341d.lib

If it is a release version, remove the "d" to make it opencv_world341.lib.

Testing:

Test the following code:

#include "cv.h"
#include "highgui.h"

int main()
{
    IplImage* src = cvLoadImage("C:\\1.png"); // The path here must be an absolute path, relative paths will cause errors
    cvNamedWindow("showImage");
    cvShowImage("showImage", src);
    cvWaitKey(0);
    cvReleaseImage(&src);
    cvDestroyWindow("showImage");
    return 0;
}
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.