int main(int,char**){VideoCapture cap(0);// open the default cameraif(!cap.isOpened())// check if we succeededreturn-1;Mat edges;
namedWindow("edges",1);for(;;){Mat frame;
cap >> frame;// get a new frame from camera
cvtColor(frame, edges, CV_BGR2GRAY);GaussianBlur(edges, edges,Size(7,7),1.5,1.5);Canny(edges, edges,0,30,3);
imshow("edges", edges);if(waitKey(200)>=0)break;}// the camera will be deinitialized automatically in VideoCapture destructorreturn0;}