添加一个环境变量(可不添) OPENCV_DIR
E:\work\openCV\opencv\build
Path中添加 OPENCV的环境变量
%OPENCV_DIR%\x64\vc14\bin
项目,右键,Properties/属性
(编译运行成功后尝试过删除此项,没发现问题)
$(OPENCV_DIR)\include
下列可只选1个
(编译运行成功后尝试过删除此项,没发现问题)
$(OPENCV_DIR)\x64\vc15\lib;$(OPENCV_DIR)\x64\vc14\lib
opencv_world***d.lib
//例
opencv_world410d.lib
参考下列链接和代码
http://www.pianshen.com/article/5813368208/#opencv_world410ddll_66
OpenCV: How to build applications with OpenCV inside the “Microsoft Visual Studio”
学习OpenCV–如何在Visual Studio中使用OpenCV - SHLLL的博客 - CSDN博客
#include
#include
#include
#include
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
String filename = (argc >= 2) ? argv[1] : "C:\\Users\\MrD\\Desktop\\catTom.jpg";
Mat image;
image = imread(filename, IMREAD_COLOR); // Read the file
if (image.empty()) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}
#include
#include
using namespace std;
using namespace cv;
int main()
{
//读取本地的一张图片便显示出来
Mat img = imread("C:\\Users\\MrD\\Desktop\\catTom.jpg");
imshow("cat Tom", img);
//等待用户按键
waitKey(0);
return 0;
}
vs c++配置opencv(1) - 枫之戊 - 博客园
设置界面操作讲解的不详细
OpenCV3.4+VisualStudio2017开发环境配置指导_百度经验
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
int main()
{
//打开一个默认的相机
VideoCapture capture(0);
//检查是否成功打开
if (!capture.isOpened())
return -1;
Mat edges;
while (1)
{
Mat frame;
capture >> frame;//从相机读取新一帧
cvtColor(frame, edges, CV_BGR2GRAY);//变为灰度图
blur(edges, edges, Size(3, 3));//均值滤波降噪
Canny(edges, edges, 5, 38, 3);//canny算子
imshow("被canny后的视频", edges);//显示
waitKey(30);
//法2:
//if(waitKey(30)>=0)//延时30ms
//break;
}
return 0;
}
测试未成功
在Visual Studio 2017配置OpenCV - Alisebeast的博客 - CSDN博客
E0020 未定义标识符 "CV_BGR2GRAY"
OpenCV应用方法——图像读取函数cv::imread()的几种使用方式 - 墨小鱼 - CSDN博客