title: Can't access webcam with OpenCV
body: <p>I'm using OpenCV 2.2 with visual studio 2010 on a win 7 64 bit pc.</p>
  
  <p>I'm able to display pictures and play AVI files through OpenCV as given in the book "Learning OpenCV" but I'm not able to capture webcam images. Even the samples given along with the OpenCV files cant access the webcam. </p>
  
  <p>I get asked for " video source -> capture source" and there are two options: HP webcam Splitter and HP webcam. If I select  HP webcam the window closes immediately without displaying any error. (i think any error message is too fast to be seen before it closes). If I select HP Webcam splitter then the new window, where the webcam images(video) are supposed to come, is filled with uniform gray. The webcam LED is on but no video is seen. My webcam works fine with flash (www.testmycam.com) and with DirectShow <a href="http://www.codeproject.com/KB/audio-video/WebcamUsingDirectShowNET.aspx" rel="nofollow">http://www.codeproject.com/KB/audio-video/WebcamUsingDirectShowNET.aspx</a> </p>
  
  <p>I did try getting some error message by using this: </p>
  
  <pre><code>#include "cv.h"
  #include "highgui.h"
  #include &lt;iostream&gt;
  using namespace cv;
  using namespace std;
  
  int main(int, char**)
  {
      VideoCapture cap("0"); // open the default camera
      if(!cap.isOpened())  // check if we succeeded
         {
       cout &lt;&lt; "Error opening camera!";
       getchar();
       return -1;
   }
  
      Mat edges;
      namedWindow("edges",1);
      for(;;)
      {
          Mat frame;
          cap &gt;&gt; frame; // get a new frame from camera
          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) &gt;= 0) break;
      }
      // the camera will be deinitialized automatically in VideoCapture destructor
      return 0;
  }
  </code></pre>
  
  <p>And the error message I got was: </p>
  
  <pre><code>warning: Error opening file (C:\Users\vp\work\ocv\opencv\modules\highgui\src\cap
  _ffmpeg.cpp:454)
  Error opening camera!
  </code></pre>
  
  <p>I don't know what this "cap_ffmpeg.cpp" is and I don't know if this is any issue with the nosy "HP Media Smart" stuff.</p>
  
  <p>Any help will be greatly appreciated.</p>