1. 程式人生 > >opencv3.2在VS2017中的配置

opencv3.2在VS2017中的配置

網上的配置雖然很多了,但是我還是想寫下自己的配置。

首先建立空專案:

然後是屬性裡的VC++和聯結器目錄修改:

具體欄位:

VC++-包含目錄:D:\opencv\build\include;D:\opencv\build\include\opencv;D:\opencv\build\include\opencv2;$(IncludePath)

VC++庫目錄:D:\opencv\build\x64\vc14\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x64;$(LibraryPath)

連結器-常規-附加庫目錄:D:\opencv\build\x64\vc14\lib;%(AdditionalLibraryDirectories)

連結器-輸入-附加依賴項:opencv_world320.lib;opencv_world320d.lib;%(AdditionalDependencies)

附上測試程式碼:

#include <opencv2\core\core.hpp>  
#include <opencv2\highgui\highgui.hpp>  
#include <iostream>  

using namespace cv;
using namespace std;


int main()
{
	char c;
	VideoCapture inputVideo(0);    //0為外部攝像頭的ID,1為筆記本內建攝像頭的ID  
	Mat src;
	for (;;)
	{
		inputVideo >> src;
		imshow("input", src);
		c = waitKey(10);
		if (c == 27) break;
	}
	return 0;
}