#include "opencv2/highgui/highgui.hpp"
include <iostream>
using namespace cv; using namespace std;
int main() { VideoCapture cap(0);
if ( !cap.isOpened() )
namedWindow("MyVideo",CV_WINDOW_AUTOSIZE);
while(1)
{
Mat frame;
bool bSuccess = cap.read(frame);
if (!bSuccess) break;
imshow("MyVideo", frame);
if(waitKey(30) == 27)break;
}