VideoCapture not working OpenCv3.0.0/lubuntu 14.04

asked 2015-12-04 23:13:32 -0600

I am pretty sure my code is ok. I used OpenCv3.0.0.

'cap' opens but 'cap.read' returns false.

The webcam (logitech sphere) works through guvcview after I used the ppa to get the latest version. The same webcam works with opencv 2.4.8 on a different machine, but essentially same lubuntu setup.

I tried going back to OpenCv 2.4.8 but it did not change anything. Still cannot read frames from camera.

Any clues would be appreciated....

#include "opencv2/highgui/highgui.hpp"

using namespace cv;

void MainWindow::on_pushButton_clicked()
    {
      VideoCapture cap(0);
      //cap.open(0);
      if (cap.isOpened())  // if not success, exit program
      {
        while(true) {
          Mat image;
          if (cap.read(image)) {
            imshow("Image", image);
          }
          int c = cvWaitKey(40);
        }
      }

    }
edit retag flag offensive close merge delete