[OpenCV](1)安装与测试
1、安装包下载地址:http://opencv.org/downloads.html
2、解压缩到D:\Program Files (x86)
3、添加环境变量:D:\Program Files (x86)\opencv\build\x86\vc10\bin
4、新建一个Win32控制台应用程序cvFirst
附加包含目录:D:\Program Files (x86)\opencv\build\include
附加库目录:D:\Program Files (x86)\opencv\build\x86\vc10\lib
附加依赖项:
opencv_calib3d2410d.lib
opencv_contrib2410d.lib
opencv_core2410d.lib
opencv_features2d2410d.lib
opencv_flann2410d.lib
opencv_gpu2410d.lib
opencv_highgui2410d.lib
opencv_imgproc2410d.lib
opencv_legacy2410d.lib
opencv_ml2410d.lib
opencv_objdetect2410d.lib
opencv_ts2410d.lib
opencv_video2410d.lib
添加代码:
1 #include "stdafx.h" 2 #include <opencv2\opencv.hpp> 3 #include <iostream> 4 #include <string> 5 using namespace cv; 6 using namespace std; 7 8 int _tmain(int argc, _TCHAR* argv[]) 9 { 10 Mat img = imread("pp.PNG"); 11 if(img.empty()) 12 { 13 cout<<"error"; 14 return -1; 15 } 16 imshow("图片",img); 17 waitKey(); 18 19 return 0; 20 }
程序运行结果:
作者:太一吾鱼水
文章未经说明均属原创,学习笔记可能有大段的引用,一般会注明参考文献。
欢迎大家留言交流,转载请注明出处。