OPENCV学习笔记1-9_视频读取
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OPENCV学习笔记1-9_视频读取相关的知识,希望对你有一定的参考价值。
#include <iostream> #include "opencv2/opencv.hpp" using namespace std; using namespace cv; int main( int argc, char** argv ) { /* VideoCapture cap(0); //open the default camera */ VideoCapture cap( "test.flv" ); if ( !cap.isOpened() ) { cerr << "Can not open a camera or file." << endl; return(-1); } Mat edges; namedWindow( "edges", 1 ); namedWindow( "frame", 1 ); for (;; ) { Mat frame; cap >> frame; //get a new frame from cap if ( frame.empty() ) break; imshow( "frame", frame ); cvtColor( frame, edges, CV_BGR2GRAY ); Canny( edges, edges, 0, 30, 3 ); imshow( "edges", edges ); if ( waitKey( 30 ) >= 0 ) break; } /* the camera will be deinitialized automatically in VideoCapture destructor */ return(0); }
以上是关于OPENCV学习笔记1-9_视频读取的主要内容,如果未能解决你的问题,请参考以下文章