标签:include break class 存储 size frame win div opencv
#include <opencv2\opencv.hpp> #include <Windows.h> using namespace cv; //-----------------------------------【main( )函数】-------------------------------------------- // 描述:控制台应用程序的入口函数,我们的程序从这里开始 //------------------------------------------------------------------------------------------------- int main( ) { //【1】读入视频 VideoCapture capture(0); Sleep(1000); Mat edges; //【2】循环显示每一帧 while(1) { Mat frame;//定义一个Mat变量,用于存储每一帧的图像 capture>>frame; //读取当前帧 imshow("读取视频",frame); //显示当前帧 cvtColor(frame, edges, CV_BGR2GRAY); blur(edges, edges, Size(3,1)); Canny(edges, edges, 0, 30, 3); imshow("提取边缘后", edges); if (waitKey(30) >= 0) break; } return 0; }
按照毛星云的出了错,在读取摄像头之前Sleep(1000)歇1s,记得#include <windows.h>
标签:include break class 存储 size frame win div opencv
原文地址:http://www.cnblogs.com/ajmd/p/6034509.html