源文件调用opencv库显示了一张图片
#include<opencv2/opencv.hpp>
int main(){
cv::Mat src=cv::imread("dog.jpg");
cv::imshow("image",src);
cv::waitKey(0);
return 0;
}
利用gcc进行编译
g++ test.cpp -o test.exe -ID:\thirdParty\opencv\build_mingw\install\include
-ID:\thirdParty\opencv\build_mingw\install\include\opencv2
-LD:\thirdParty\opencv\build_mingw\install\x64\mingw\lib
-lopencv_core410 -lopencv_imgcodecs410 -lopencv_imgproc410
-lopencv_calib3d410 -lopencv_highgui410
//其中-I后面跟的是头文件目录,-L后面是库文件路径,-l后面是要链接的库
编译后生成可执行文件test.exe,可以显示图片