OpenCV (vs) installation and configuration environment, and the problem that opencv_world460.dll cannot be found

Table of contents

1. Opencv official website download

Two, configuration

1. vs Create a new C++ project

​edit 

 2. Find the property manager

 3. Start adding

 4. Test

3. About the problem of not being able to find opencv_world460.dll (or other versions)


1. Opencv official website download

Official website download address:

https://opencv.org/releases/

Two, configuration

1. vs Create a new C++ project

Select Release for the solution configuration, and select x64 for the solution platform

 

 2. Find the property manager

Vs2019 version steps: View--->Other windows--->Property Manager

Select releasex64 -> double click

 3. Start adding

Select the include directory under the VC++ directory

 Find the location where opencv is installed, add the two folders shown in the figure below to the first window, and click OK

 

 

 In the same way, open the library directory ---> add the lib folder in cv15 (cv14 is also available, cv15 is recommended)

 Open Connector ---> Input -----> Additional Dependencies

 Select opencv_world460.lib (according to your own version)

All OK.

 4. Test

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

void ImageThreshold(String str) {
	Mat image = imread(str);
	Mat binary;
	cvtColor(image, binary, COLOR_BGR2GRAY);
	imshow("test_opencv_srtup", binary);
	waitKey(0);
}
int main() {
	String str = "jennie.jpg"; // 注意文件路径和你所对应的图片
	ImageThreshold(str);
	return 0;
}

3. About the problem of not being able to find opencv_world460.dll (or other versions)

Encountered such a problem is because the environment variable is not configured

Find the bin directory in the cv15 folder after opencv installation, and copy the path

This Computer--->Management--->Advanced System Settings-->Environment Variables--->path

New--->Copy Path

 

 All OK.

Guess you like

Origin blog.csdn.net/hjl011006/article/details/127015522