Ask Your Question

Revision history [back]

Just simply change your complete code to the C++ API. It will make everything run just fine.

Try this:

 int main()
 {
    VideoCapture capture (0);
    Mat src1, src2;
    while (true)
    {
       capture >> scr1;
       cvtColor(src1.clone(),src2,CV_BGR2GRAY); 
       imshow("TestWebCam", src1);
       imshow("TestWebCam2", src2);

       int key = waitKey(10);
       if(key == 27)
       {
          break;
       }
}

Just simply change your complete code to the C++ API. It will make everything run just fine.

Try this:

 int main()
 {
    VideoCapture capture (0);
    Mat src1, src2;
    while (true)
    {
       capture >> scr1;
       cvtColor(src1.clone(),src2,CV_BGR2GRAY); 
       imshow("TestWebCam", src1);
       imshow("TestWebCam2", src2);

       int key = waitKey(10);
       if(key == 27)
       {
          break;
       }
    }
 }