#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <string.h>
#include <fstream>
using namespace cv;
int main( int argc, char** argv )
VideoCapture cap(0); //開啟攝影機
if(!cap.isOpened()) return -1; //確認攝影機打開
namedWindow("MyCamera",1); //建立一個視窗,名稱為MyCamera
Mat frame; //用矩陣紀錄抓取的每張frame
for(;;)
cap >> frame; //把取得的影像放置到矩陣中
imshow("MyFrame", frame); //建立一個視窗,顯示frame到camera名稱的視窗
if(waitKey(30) >= 0) break; //按鍵就離開程式
system("PAUSE");
return 0;
04 顯示攝影機WebCam的畫面
No comments:
Post a Comment