title: OpenCV2.2 cvCaptureFromCAM problems...only returning a green screen. (Logitech C260 camera)
body: <p>I'm writing a program that needs to capture from a webcam using opencv.  I am using a Logitech C260 Camera and OpenCV2.2, Windows XP, QT Creator.  Here is an example piece of my code:</p>
  
  <pre><code>int i = 0;
  
  int arg = 0;
  CvCapture *pCapturedImage = cvCaptureFromCAM(arg);
  
  cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
  IplImage* img1= cvQueryFrame(pCapturedImage);
  IplImage* img2;
  IplImage* merged;
  int MAX_FRAMES = 10;
      for (int i = 0; i &lt; MAX_FRAMES; i++){
      pCapturedImage = cvCaptureFromCAM(arg);
      if (!pCapturedImage){
          printf("Uh oh");
      }
      img1 = cvQueryFrame(pCapturedImage);
  
      printf("Query");
      cvShowImage( "Example1", img1 );
      cvWaitKey(0);
  }
  for (int i = 0; i &lt; MAX_FRAMES; i++){
      printf("Enter");
      img2 = img1;
      pCapturedImage = cvCaptureFromCAM(arg);
      if (!pCapturedImage){
          printf("Uh oh");
      }else
      printf("Capture");
      img1 = cvQueryFrame(pCapturedImage);
      printf("Query");
      cvShowImage( "Example1", img1 );
      cvWaitKey(0);
      img1 = mergePhotos(img2, img1, i*25, i*25);
      printf("Merge");
      cvShowImage( "Example1", img1 );
      cvWaitKey(0);
  </code></pre>
  
  <p>}</p>
  
  <p>It's not working though.  I'm getting only a for around the first 10 captures, then after that, the capture becomes null (I'd post a picture but I'm not allowed to).</p>
  
  <p>I'm stumped.  I've tried cvCaptureFromCAM and cvCreateCameraCapture.  I've tried changing the args to that function.  I've tried all my USB ports.</p>
  
  <p>Does anybody know what the problem might be?  I greatly appreciate all help.</p>