[OpenCV series] [1] OpenCV development environment configuration

This article introduces how to build the development environment of opencv c++? The python version of cv is easy to install, so I won't talk about it here.

The environment is: windows10+vs2017 community version+opencv3.4

[1] opencv download

https://opencv.org/releases.html

After the download is complete, click Install to:

[2] Environment variable configuration

Will

C:\Users\xxx\install\opencv3\opencv\build\x64\vc15\bin

Add to Windows Environment Variables

[3] The project contains the configuration of the include directory

Open "View" ---> "Property Pages"

Will

C:\Users\ThinkPad\install\opencv3\opencv\build\include\opencv2

C:\Users\ThinkPad\install\opencv3\opencv\build\include\opencv

C:\Users\ThinkPad\install\opencv3\opencv\build\include

Add these three directories to "Include Directories"

[4] Configuration of lib library

Will

C:\Users\ThinkPad\install\opencv3\opencv\build\x64\vc15\lib

Add to "Library Directory"

[5] Add lib library

C:\Users\ThinkPad\install\opencv3\opencv\build\x64\vc15\lib\opencv_world340d.lib

The current platform is debug, so opencv_world340d.lib is used here

At the same time, the release platform is also added

C:\Users\ThinkPad\install\opencv3\opencv\build\x64\vc15\lib\opencv_world340.lib

If " error LNK1112: The module computer type "X86" conflicts with the target computer type "x64" ", adjust the working mode to the same:

[6] Copy the dll to the sys directory

Copy these three dlls to:

C:\Windows\System32 and C:\Windows\SysWOW64 below

【7】Test

#include<opencv2/opencv.hpp>
using namespace cv;

int main() {
    Mat img = imread("C:\\Users\\ThinkPad\\Desktop\\QQ截图20180408222456.png");
    imshow("s", img);
    waitKey(0);
}

 

At that time, the png format was written as jpg, which caused an inexplicable error

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325239512&siteId=291194637