Visual.Studio2013OpenCV3.0b机器视觉应用.ppt
《Visual.Studio2013OpenCV3.0b机器视觉应用.ppt》由会员分享,可在线阅读,更多相关《Visual.Studio2013OpenCV3.0b机器视觉应用.ppt(65页珍藏版)》请在三一办公上搜索。
1、Visual Studio&OpenCV机器视觉应用,3.0,Open Source Computer Vision:开源计算机视觉(库),OpenCV现有中文教材,基于OpenCV1.X,建议基本掌握2.x基本环境后,再阅读。,OpenCV现有中文教材,基于OpenCV2.X,OpenCV帮助,opencvdoc1、opencv_cheatsheet.pdf(OpenCV简明表)2、opencv_tutorials.pdf(OpenCV案例教程)*3、opencv2refman.pdf(OpenCV参考手册)*4、opencv_user.pdf(OpenCV用户入门)5、opencv2man
2、ager.pdf(OpenCV安卓配置)http:/OpenCV网址:http:/opencv.org/http:/http:/,opencv_cheatsheet.pdf:简明表(2页),Key OpenCV Classes:关键类Matrix Basics:矩阵基础Matrix Manipulations:Copying,Shuffling,Part Access:矩阵的操作Image Processing:图像处理Data I/O:数据输入输出Simple GUI(highgui module):简单界面Camera Calibration,Pose Estimation and Dep
3、th Estimation:摄像机标定 Object Detection:物体探测,opencv_user.pdf:用户入门(23页),1 Operations with images:操作数字图像2 Features2d:特征点3 HighGUI:使用Kinect(微软注册)体感摄影机和其他OpenNI兼容的深度传感器。OpenNI(开放自然交互)是一个多语言,跨平台的框架。4 Cascade Classifier Training:级联分类器训练5 HighGUI:使用英特尔Creative Senz3D或其它感知计算SDK 兼容的深度传感器,重点说明,opencv_tutorials.p
4、df:案例教程(493页),1 Introduction to OpenCV2 core module.The Core Functionality3 imgproc module.Image Processing4 highgui module.High Level GUI and Media5 calib3d module.Camera calibration and 3D reconstruction6 feature2d module.2D Features framework7 video module.Video analysis8 objdetect module.Object
5、Detection9 ml module.Machine Learning10 photo module.Computational photography11 gpu module.GPU-Accelerated Computer Vision12 OpenCV iOS13 OpenCV Viz14 General tutorials,完整实例,opencv2refman.pdf:参考手册(731页),1 Introduction2 core.The Core Functionality3 imgproc.Image Processing4 imgcodecs.Image file read
6、ing and writing5 videoio.Media I/O6 highgui.High-level GUI and Media I/O7 video.Video Analysis8 calib3d.Camera Calibration and 3D Reconstruction9 features2d.2D Features Framework10 objdetect.Object Detection11 ml.Machine Learning12 flann.Clustering and Search in Multi-Dimensional Spaces13 photo.Comp
7、utational Photography14 stitching.Images stitching15 cuda.CUDA-accelerated Computer Vision16 cudaarithm.CUDA-accelerated Operations on Matrices17 cudabgsegm.CUDA-accelerated Background Segmentation18 cudacodec.CUDA-accelerated Video Encoding/Decoding19 cudafeatures2d.CUDA-accelerated Feature Detecti
8、on and Description20 cudafilters.CUDA-accelerated Image Filtering21 cudaimgproc.CUDA-accelerated Image Processing22 cudaoptflow.CUDA-accelerated Optical Flow23 cudastereo.CUDA-accelerated Stereo Correspondence24 cudawarping.CUDA-accelerated Image Warping25 shape.Shape Distance and Matching26 superre
9、s.Super Resolution27 videostab.Video Stabilization28 viz.3D Visualizer,片段说明,OpenCV版本,Version 3.0b,Visual C+及其MFC版本,MFC version 6.0(still mfc42.dll)Visual C+version 6.0MFC version 7.0(mfc70.dll)Visual C+.NET 2002MFC version 7.1(mfc71.dll)Visual C+.NET 2003MFC version 8.0(mfc80.dll)Visual C+2005MFC ve
10、rsion 9.0(mfc90.dll)Visual C+2008MFC version 10.0(mfc100.dll)Visual C+2010,MFC version 11.0 Visual C+2012MFC version 12.0 Visual C+2013,OpenCV的目录,D:Program FilesOpenCVsourcesD:Program FilesOpenCVbuild,OpenCV2.4.3+Visual Studio2008 配置,运行库系统环境变量Path:.OpenCV2.4.3buildx86vc9bin;包含文件目录:.OpenCV2.4.3buildi
11、nclude编译库文件目录:.OpenCV2.4.3buildx86vc9lib,链接/输入/附加依赖项目:(带d的为Debug,不带为Release)opencv_core243.lib opencv_core243d.libopencv_highgui243.lib opencv_highgui243d.libopencv_ml243.lib opencv_ml243d.lib。,OpenCV3.0b+Visual Studio2013 配置1,Vs2010以后采用属性表作为工程设置运行库系统环境变量Path:.OpenCV3.0bbuildx86vc12bin;编译库文件目录:.Open
12、CV3.0bbuildx86vc12lib包含文件目录:.OpenCV3.0bbuildinclude,链接/输入/附加依赖项目:(带d的为Debug,不带为Release)opencv_ts300.libopencv_world300.libopencv_ts300d.libopencv_world300d.lib,OpenCV3.0b+Visual Studio2013 配置2,OpenCV3.0b+Visual Studio2013 配置3,实例ReadImg,读取一张图片-旧,#include stdafx.h#include#include opencv/cv.h/使用旧版本函数#i
13、nclude opencv/highgui.husing namespace cv;using namespace std;int main(int argc,_TCHAR*argv)IplImage*myImg=cvLoadImage(D:1.bmp);/读入图像 if(!myImg)/如果读入图像失败 return-1;namedWindow(zdq,1);/创建窗口 cvShowImage(zdq,myImg);/显示图像 waitKey();/等待按键,按键盘任意键返回 cvDestroyWindow(zdq);/释放窗口 return 0;,Release版本项目属性,链接器,输入o
14、pencv_core243.libopencv_highgui243.libopencv_ml243.lib,实例UseCam-旧,#include stdafx.h#include#include opencv/cv.h#include opencv/highgui.husing namespace cv;using namespace std;CvCapture*capture;int c;IplImage*frame;void on_trackbar()while(true)frame=cvQueryFrame(capture);/循环获得摄像机得到的帧 if(!frame)break;
15、if(c=cvWaitKey(100)=27)break;/Esc的时候退出循环 cvShowImage(frame,frame);cvWaitKey(1000);int main(int argc,char*argv)capture=cvCaptureFromCAM(1);/获取摄像头 if(!capture)printf(Could not initialize capturing.n);return-1;cvNamedWindow(frame,1);/构建窗口on_trackbar();cvWaitKey(0);cvReleaseCapture(,Release版本项目属性,链接器,输入
16、opencv_core243.libopencv_highgui243.libopencv_ml243.lib,01加载并显示图像(CV01_ShowImage),#include/OpenCV统一的头文件#include int main(int argc,char*argv)const char*imageName=./pic.jpg;/图像路径及文件名cv:Mat image=cv:imread(imageName,cv:IMREAD_COLOR);if(!image.data)/数据校验std:cout 无法打开图像 std:endl;cv:waitKey();return-1;cv:
17、namedWindow(“Display window”,cv:WINDOW_AUTOSIZE);/窗口cv:imshow(Display window,image);/将图像显示在窗口cv:waitKey(0);/等待按键cv:destroyWindow(Display window);/销毁窗口return 0;,02加载并播放视频文件(CV02_PlayVideo),#include/OpenCV统一的头文件#include int main(int argc,char*argv)const char*imageName=./avi.avi;/图像路径及文件名cv:VideoCaptur
18、e captureVedio(imageName);if(!captureVedio.isOpened()std:cout frameVedio;bool isStop=false;cv:namedWindow(frameVedio,1);while(!isStop)/应该判断视频文件结束captureVedioframeVedio;/captureVedio.read(frameVedio);if(frameVedio.data)/循环获得视频文件的帧cv:imshow(frameVedio,frameVedio);if(cv:waitKey(30)=27)isStop=true;/读取时间
19、,遇到esc退出elseisStop=true;/播放完毕captureVedio.release();cv:destroyWindow(frameVedio);/销毁窗口return 0;,03获取摄像头并录像(CV03_CameraRecorder),#include/OpenCV统一的头文件#include int main(int argc,char*argv)cv:VideoCapture captureCamera(0);/获取摄像头/double rate=captureCamera.get(CV_CAP_PROP_FPS);if(!captureCamera.isOpened(
20、)std:cout frameCamera;bool isStop=false;cv:VideoWriter frameWriter;/不可直接关闭程序,否则文件不可以播放frameWriter.open(./Recorded.avi,0,24,cv:Size(640,480),true);while(!isStop)/应该判断视频文件结束if(captureCamera.read(frameCamera)/循环获得摄像机得到的帧cv:imshow(frameCamera,frameCamera);frameWriter.write(frameCamera);if(cv:waitKey(30)
21、=27)isStop=true;/写入需要时间,另外遇到esc退出elseisStop=true;frameWriter.release();captureCamera.release();cv:destroyWindow(frameCamera);return 0;,04遍历像素算运行时间(CV04_AccessPixelTime),void colorReduceMask(cv:Mat,05锐化图像(CV05_Sharpen),void sharpen(const cv:Mat,06颜色匹配类(CV06_FindColorClass),class ColorDetectorprivate:
22、int maxDistance;/可接受的最大差距cv:Vec3b target;/目标像素cv:Mat_ result;/检测结果图像public:ColorDetector(int dis=100,cv:Vec3b color=cv:Vec3b(0,0,0)if(dis(i);uchar*itOut=result.ptr(i);for(int j=0;j(abs(*data+-target0);/防止超限getDist+=cv:saturate_cast(abs(*(data+)-target1);getDist+=cv:saturate_cast(abs(*(data+)-target2
23、);if(getDist M;result.copyTo(M);return M;,07直方图(CV07_Histogram),/直方图用于统计和查找#include/好像编译后的文件会大一点#include class Histogram1Dprivate:int histSize1;/横坐标项的数量float hranges2;/像素的最大和最小值const float*ranges1;int channels1;public:Histogram1D();/构造函数cv:MatND getHistogram(const cv:Mat,Mat类(CV08_Mat),#include#incl
24、ude using namespace cv;using namespace std;int main(int argc,char*argv)Mat A=imread(./pic.jpg,IMREAD_COLOR);if(!A.data)cout compression_params;compression_params.push_back(cv:IMWRITE_PNG_COMPRESSION);compression_params.push_back(9);tryimwrite(./D.jpg,D,compression_params);catch(runtime_error,Mat是一个模
25、板类,Mat M(2,2,CV_8UC3,Scalar(0,0,255);Mat L(3,3,CV_8UC1,Scalar:all(0);M.create(4,4,CV_8UC3);Mat E=Mat:eye(4,4,CV_64F);Mat O=Mat:ones(2,2,CV_32F);Mat Z=Mat:zeros(3,3,CV_8UC1);format(R,python);Mat E=A(Range:all(),Range(1,100);/行列范围,Mat()Constructor构造函数,#include stdafx.h#include#include/#pragma comment(
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Visual Studio2013OpenCV3 机器 视觉 应用
链接地址:https://www.31ppt.com/p-6523014.html