Ask Your Question

Revision history [back]

try that:

VideoCapture cap(0);
if(cap)
{
    white(1)
    {
        Mat image;
        cap>>image;
        if (!image.data) break;
        if (waitKey(30) >= 0) break;

        imshow("test",image);
        waitKey(1);
    }
}

try that:

VideoCapture cap(0);
if(cap)
{
    white(1)
while(1)
    {
        Mat image;
        cap>>image;
        if (!image.data) break;
        if (waitKey(30) >= 0) break;

        imshow("test",image);
        waitKey(1);
    }
}