opencv 摄像头

时间:2014-05-01 06:28:49   收藏:0   阅读:333
mamicode.com,码迷
 
    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;
    }
mamicode.com,码迷

 

opencv 摄像头,码迷,mamicode.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!