opencv 摄像头

 
    VideoCapture cap(0);
    if(!cap.isOpened())
        return -1;
    Mat frame, edges;
    namedWindow("edges",1);
    for(;;)
    {
        cap >> frame;
        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(30) >= 0) break;
    }

 

posted @ 2014-04-30 18:43  代码学习者coding  阅读(252)  评论(0编辑  收藏  举报