在Visual Studio 2019中配置OpenCV环境
配置流程
- 安装OpenCV。
- 在VS中创建新的项目。
- Solution Explorer中右击项目名,选择Properties。
- 在VC++ Directories中选择Include Directories,配置
- 安装目录\opencv\build\include
- 安装目录\opencv\build\include\opencv
- 安装目录\opencv\build\include\opencv2
- 在VC++ Directories中选择Library Directories,配置
- 安装目录\opencv\build\x64\vc14\lib
- 在Linker-->Input中配置Additional Dependencies
- opencv_world3410d.lib(具体在安装目录\opencv\build\x64\vc14\lib中查看)
- 编写程序:在Source Files中Add-->New item:
#include
#include
using namespace cv;
int main() {
Mat input_image = imread("图片路径");
namedWindow("test");
imshow("test", input_image);
waitKey(0);
return 0;
}
- 安装目录\opencv\build\include
- 安装目录\opencv\build\include\opencv
- 安装目录\opencv\build\include\opencv2
- 安装目录\opencv\build\x64\vc14\lib
- opencv_world3410d.lib(具体在安装目录\opencv\build\x64\vc14\lib中查看)
#include
#include
using namespace cv;
int main() {
Mat input_image = imread("图片路径");
namedWindow("test");
imshow("test", input_image);
waitKey(0);
return 0;
}