1

I tried to open default camera using below code. But it can't. There is a topic same issue.But I can't find a menu to include HAVE_VIDEOINPUT HAVE_DSHOW. ( I tried cap(0) and cap(1) )

VideoCapture cap(1); // open the default camera
int iSliderValue1 = 50, iSliderValue2 = 255;
Mat thresholdImage;
Mat frame;


if(!cap.isOpened())  // check if we succeeded
{
    cout << "Webcam cannot open!\n" ;
    return -1;
}

Also,when I run "lsusb" command, the output is below enter image description here

Community
  • 1
  • 1
  • Have you tried `cap(-1)` ? – karlphillip Sep 29 '14 at 01:25
  • Yes, I did. I installed xenomai on ubuntu and compiled kernel. Before it, my code was fine. Maybe default camera was changed. How can I check id of default camera? –  Sep 29 '14 at 01:27
  • Experimentation! Can you check that your camera works with other applications? – karlphillip Sep 29 '14 at 02:45
  • A camera is likely to show up as `/dev/videoX`, X being some number. That goes as the device ID in `cap.open(X)`. – a-Jays Sep 29 '14 at 05:41
  • @a-Jays when I run "ls /dev/video*", the output is "/dev/video* ls: cannot access /dev/video*: No such file or directory". –  Sep 29 '14 at 16:35
  • on my pc,there is not video folder under dev/. Should I install cheese like below link? http://shainky-at-ubuntu.blogspot.com.tr/2009/04/running-webcams-in-ubuntu.html –  Sep 29 '14 at 16:43
  • I'm not sure what the issue might be, since `lsusb` shows your camera. Install gucviewer and see if you can get your camera to work. Maybe some issue with the drivers? – a-Jays Sep 29 '14 at 17:29

0 Answers0