一:官网下载opencv。后直接安装。


二:新建c++空项目。?

三:配置opencv环境。右键项目目录(不是解决方案)-》属性。

四:配置包含目录。vc++目录-》包含目录》右面箭头》编辑。

五:配置库目录
?
?六:目标计算机及平台等改为X64

七:链接器配置。
opencv_world453d.lib对应自己安装目录中lib文件。
例如:C:\opencv\opencv\build\x64\vc15\lib

八:将opencv添加到计算机环境中
?

九: 文件复制
将下列文件复制到C盘的C:\Windows\SysWOW64 和C:\Windows\System32 文件夹中
?
?
至此所有的配置步骤已经完成。
?十:添加测试文件。
?
添加测试代码。运行。(C:\\picture\\4.png为自己图片目录)
无报错,即成功。
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat img = imread("C:\\picture\\4.png");
if (img.empty())
{
printf("Could not find the image!\n");
return -1;
}
imshow("ImputImage", img);
waitKey(0);
return 0;
}
?
?
?
?
?
?
?
?
|